Observing a UISlider's value - iPhone KVO

2019-04-30 15:57发布

By default, when I observe the value of a UISlider, it only updates once, when the slider is clicked, not continuously, even thought that is the slider's setting. Is there a way to get the continuous value change of the slider?

2条回答
倾城 Initia
2楼-- · 2019-04-30 16:27

the continuous updating applies to the calling of the target method of the "value changed" event on the slider. I don't know how to do this with KVO

查看更多
等我变得足够好
3楼-- · 2019-04-30 16:33

UIKit doesn't actively support KVO. You may be getting lucky in that some notifications may make it through the usual mechanisms, but for the most part you shouldn't assume you can use KVO with any UIKit class.

You should instead get your continuous events through the UISlider's associated target's action method.

查看更多
登录 后发表回答