Observing a UISlider's value - iPhone KVO

你说的曾经没有我的故事 提交于 2019-12-07 05:35:47

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/1482527/observing-a-uisliders-value-iphone-kvo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!