UIScrollView scrolling speed [duplicate]

2019-05-07 10:29发布

This question already has an answer here:

Is there any way to reduce the speed of scrolling in the UIScrollView, I tried to use scrollRectToVisible: animated: NO to accomplish this (by setting the animation to NO) but seems it's not the right way.

2条回答
家丑人穷心不美
2楼-- · 2019-05-07 10:49

You can use a simple uiview animation to do that..

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
[scrollview scrollRectToVisible:rect animated:NO];
[UIView commitAnimations];

that's the only way I am aware of.

ios 4 way (this will not work on iphones still running 3.x) :

[UIView animateWithDuration:2 animations:^(void){
    [scrollview scrollRectToVisible:rect animated:NO];
}];
查看更多
祖国的老花朵
3楼-- · 2019-05-07 10:51

I know this is not exactly what you asked for but it may help you to set deceleration rate with UIScrollView property

@property(nonatomic) float decelerationRate
查看更多
登录 后发表回答