0
votes

I want move the ContentOffset of my UISCrollView. I'm using different methods, CABasicAnimation or UIView animateWithDuration but the problem is that, during the animation, my UIScrollView is clipped from the right and left sides.

When animation is finished, the size of the UIScrollView seems right.

- (void)animateScrollToTheBottom {

   self.scroll.scrollEnabled = NO;

   CGFloat scrollHeight = self.scroll.contentSize.width;

   [UIView animateWithDuration:10
                         delay:0
                       options:UIViewAnimationCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
      animations:^{

         self.scroll.contentOffset = CGPointMake(0, scrollHeight);

     } completion:^(BOOL finished) {

        self.scroll.scrollEnabled = YES;

   }];
}

Any suggestions? Thanks!

1
did you try self.scroll.clipToBounds = NO? - Avi Tsadok
Thanks Avi! Nice, now i eliminate the right clipping... Now i can investigate with is - Fran Fox
Avi, i think that i'm moving the UIScrollView outside screen to left but i don't understand why. If i don't call the animation, the Scroll fits correctly on the screen. - Fran Fox
Ok! If i start the animation with some delay, using performSelectorWithObjectAfterDelay works fine! - Fran Fox
Most of the time, if you reach the point when you have to start something with delay, it means something is wrong with the code. I suggest you double check it... I will try to investigate your issue later today.. - Avi Tsadok

1 Answers

0
votes
[UIView animateWithDuration:5.0f animations:^ {
    [scrollView setContentOffset:destination animated:NO];
}];

worked for me