Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个UISlider从 0 到 5 的值。我希望拇指只停在确切的值上,而不是介于两者之间。以编程方式移动滑块是唯一的选择吗?或者是否有控制这种行为的属性?
UISlider
使用函数 round 从滑块中获取值
NSInteger value = (NSInteger)round(slider.value); NSLog(@"Slider value is %d", value);