UIScrollView - showing the scroll bar

前端 未结 10 1755
-上瘾入骨i
-上瘾入骨i 2020-11-27 20:32

Possibly a simple one!

Does anyone know how to get the scroll bar of a UIScrollView to constantly show?

It displays when the user is scrolling, so they can s

10条回答
  •  暖寄归人
    2020-11-27 21:29

    Swift 3

    You can access the scrollbar using scrollView.subviews and modify the alpha as shown here. It works for me.

    extension UIScrollView {
        override open func touchesEnded(_ touches: Set, with event: UIEvent?) {
            for x in self.subviews {
                x.alpha = 1.0
            }
        }
    }
    
    extension MyScrollViewDelegate : UIScrollViewDelegate {
        func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
            for x in scrollView.subviews {
                x.alpha = 1.0
            }
        }
    }
    

提交回复
热议问题