UIScrollView scrolling speed [duplicate]

我们两清 提交于 2019-12-10 07:47:38

问题


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.


回答1:


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];
}];



回答2:


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


来源:https://stackoverflow.com/questions/5815993/uiscrollview-scrolling-speed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!