【问题标题】:How to adjust the scroll speed of UIScrollview in iOS swift?如何在 iOS swift 中调整 UIScrollview 的滚动速度?
【发布时间】:2021-06-25 20:54:07
【问题描述】:

我尝试使用

设置我自己的滚动速度
self.scrollView.decelerationRate = .init(rawValue: 0.20)

但是,这仅控制减速,我想降低拖动本身的滚动速度。

【问题讨论】:

    标签: ios swift uiscrollview


    【解决方案1】:

    最后,我可以通过设置 scrollview 本身的内容偏移量来强制停止 scrollViewDidEndDragging 委托内的滚动。

    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
            //check for scrollview status here
            if decelerate{
                self.scrollView.setContentOffset(self.scrollView.contentOffset, animated:false) // this will force stop the scrolling so that Drawable view can be added to pages
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-02
      • 2011-08-14
      • 1970-01-01
      • 2020-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多