Tap on UISlider to Set the Value

前端 未结 6 520
無奈伤痛
無奈伤痛 2021-02-01 19:20

I created a Slider (operating as control of the video, like YouTube has at the bottom) and set the maximum (duration) and minimum values. And then used SeekToTime t

6条回答
  •  耶瑟儿~
    2021-02-01 20:05

    It seems like just subclassing UISlider and returning always true to the beginTracking produce the desired effect.

    iOS 10 and Swift 3

    class CustomSlider: UISlider {
        override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
            return true
        }
    }
    

    Use the CustomSlider instead of UISlider afterwards in your code.

提交回复
热议问题