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

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

最佳答案

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

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

10-08 01:03