I am attempting to modify the contentOffset of my scroll within the following delegate method:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
I have tried both of the following:
[UIView animateWithDuration:.2 animations:^ {
[scrollView setContentOffset:CGPointZero animated:NO];
}];
and
[UIView animateWithDuration:.2 animations:^ {
CGRect svBounds = self.bounds;
svBounds.origin.y = 0;
self.bounds = svBounds;
}];
The problem is that although this changes the offset right away (proven by logs after the animation is complete), it doesn't change the visible scroll location. This is further proven by subsequent delegate methods of my scroll view which indicate that the bounds have indeed not changed at all. Meaning that the y location is not 0.
Is it forbidden to change the content offset in this particular delegate method? If so, when is it possible for me to change the offset? I'm trying to perform an animation of returning the visible scroll area to the top once the user finishes dragging (after a certain amount).
Thanks!