UIScrollView滚动速度

leC*_*Con 4 iphone scroll uiscrollview vertical-scrolling

有没有办法降低UIScrollView中的滚动速度,我试图用它 scrollRectToVisible: animated: NO来完成这个(通过将动画设置为NO),但似乎这不是正确的方法.

Bas*_*ian 8

您可以使用简单的uiview动画来做到这一点..

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
[scrollview scrollRectToVisible:rect animated:NO];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

这是我所知道的唯一方式.

ios 4方式(这在仍然运行3.x的iphone上不起作用):

[UIView animateWithDuration:2 animations:^(void){
    [scrollview scrollRectToVisible:rect animated:NO];
}];
Run Code Online (Sandbox Code Playgroud)


Dam*_*bin 7

我知道这不是你要求的,但它可以帮助你设置UIScrollView属性的减速率

@property(nonatomic) float decelerationRate
Run Code Online (Sandbox Code Playgroud)