放慢UIScrollView滚动

问题描述:

我正在使用UIScrollView以编程方式为某些内容添加动画。放慢UIScrollView滚动

但是,我需要减慢视图的滚动。

这是我使用的滚动代码:

self.scrollView.setContentOffset(CGPoint(x: 0, y: self.view.frame.height), animated: true)

我已尝试添加scrollView.decelerationRate = UIScrollViewDecelerationRateFast但它似乎并没有奏效。

试试下面的代码:

UIView.animate(withDuration: 1.5) { 
    self.scrollView.contentOffset = CGPoint(x: 0, y: self.view.frame.height) 
} 
+0

救了我的一天,谢谢。 – dpstart