簡體   English   中英

如何調整iOS swift中UIScrollview的滾動速度?

[英]How to adjust the scroll speed of UIScrollview in iOS swift?

我嘗試使用設置我自己的滾動速度

self.scrollView.decelerationRate = .init(rawValue: 0.20)

但是,這僅控制我想降低拖動本身的滾動速度的減速。

最后,我可以通過設置 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
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM