当用户滑动时显示值
请我最近制作了一个滑块,允许用户选择 KM 中的搜索算法的半径,我只需要在用户滑动时显示此滑块的值,如本演示所示( http://www.youtube.com/watch?v=FEAkVCouI_Y) 或什至作为滑块上方的小弹出消息,显示价值(我想这会更专业),提前谢谢:)))
please i recently have maked a slider which allow user to select the radius of the search algorithm in KM, i just need to display the value of this slider while the user slides like shown in this demonstration ( http://www.youtube.com/watch?v=FEAkVCouI_Y) or even as a small popup message above the slider showing the value(which will be more professional i guess), thx in advance :)))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要设置 UISlider 属性,命名为“连续”。正如文档中所述:“如果是,滑块将连续发送更新事件到关联目标的操作方法。如果否,滑块仅在用户释放滑块的拇指控件以设置最终值时发送操作事件。
默认值该属性的值是“是”。
(我想知道,如果默认值为“YES”,为什么它被禁用?)
其次,您必须向 UISlider 对象添加一个目标。您可以使用 addTarget:... message:
据我记得,您需要 UIControlEventValueChanged 控件事件类型。
You need to setup UISlider property, named "continuous". As it is told in documentation: "If YES, the slider sends update events continuously to the associated target’s action method. If NO, the slider only sends an action event when the user releases the slider’s thumb control to set the final value.
The default value of this property is YES."
(I wonder, why it is disabled if the default value is "YES"?)
Second, you'll have to add a target to a UISlider object. You can do it with addTarget:… message:
As far as I remember, you need UIControlEventValueChanged control event type.