如何改变“scrollView.setContentOffset”的速度

时间:2018-02-14 09:52:44

标签: ios swift swift4

如何更改“setContentOffset”的滚动视图速度?

scrollView.setContentOffset(CGPoint(x: 120.5, y: 0), animated: true)

1 个答案:

答案 0 :(得分:0)

在动画块中包裹setContentOffset(offset, animated: false)

UIView.animate(withDuration: 0.5, animations: {
            scrollView.setContentOffset(CGPoint(x: 0, y: yOffset), animated: false)
        })