问题描述
因此,我是IOS开发人员和Xcode的新手,但在许多其他技术中,我并不是UI组件的新手.我正在实现UISlider并调查了它的API,但找不到如何:
So I am new to IOS dev and Xcode but far from being a newbie in UI components in many other technologies. I am implementing a UISlider and investigated its API but could not find out how to:
- 添加捕捉行为(0-9,当最终用户滑至3.67拇指时将捕捉至4)
- 一个复选框,它将在情节提要模式下显示值@运行时(如悬停工具提示),而无需添加标签
- 将标记添加到滑块-0-9,在每个回合中显示一条短的垂直线#
是否可能缺少这些基本功能?我以为这将是内置UISlider的一部分.
Could it be that these basic features are missing? I assumed this will be part of the built-in UISlider.
谢谢
推荐答案
1 + 2)是的,没有内置的捕捉功能,但是您可以自己轻松实现.只需捕获滑块的值更改事件,然后将其值更新为所需值即可.四舍五入滑块值的操作方法也可以更新显示该值的标签.
1 + 2) Yes, there is no built-in snap functionality, but you can implement it yourself easily. Just catch the value-changed events of the slider, and update its value to the desired value. The action method for rounding the slider values can update a label displaying the value, too.
2 + 3)您必须自己实现.这些功能是针对特定用例的. UIKit
不是用于一般目的的一组小型构建块.
2 + 3) You must implement that by yourself. These features are very use case specific. UIKit
is rather than a set of small building blocks for general purposes.
这篇关于UISlider-缺少的功能-捕捉,工具提示和刻度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!