Is there a way to change the scrollRectToVisible speed?

Is there a way to change how fast the scrollRectToVisible animation is when scrolling through a UIScrollView?

+4
source share
2 answers

No, not using public methods. Duration is fixed at 0.3 seconds.

To change the duration, there is a closed, undocumented API :

@interface UIScrollView(UIScrollViewInternal) -(void)_setContentOffsetAnimationDuration:(NSTimeInterval)duration; @end 

but like all undocumented APIs, using this will lead to the abandonment of the AppStore.

+6
source

Just tweak the NO animation argument, and then do your own animation using the methods of the UIView animation class.

 [UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionCurveEaseOut animations:^{ [scrollView scrollRectToVisible:viewFrame animated:NO]; } completion:nil]; 
+13
source

All Articles