初学者,请教一个 slider 的问题

2020-09-30 22:42:24 +08:00
 Zaptain

我在学习用 slider 制作一个调节页面背景色的小程序的过程中发现,在左侧的面板上将它的 valve 和 maximum 都改成 255 的话,在模拟后滑块却在最左端,我的 slider 是用拖动的方式创建的,用的是 UIkit 我试了如果保持它的默认最大值是 1 的话,去调节 value,这时开始模拟是正常的,但往上改一些的话就不正常了,请问这是怎么回事呢?

1017 次点击
所在节点    iOS
3 条回复
Building
2020-10-01 15:39:18 +08:00
我记得 UISlider 值域好像就是 0 ~ 1
Building
2020-10-01 15:42:43 +08:00
The current value must be between the minimum and maximum values. If you try to programmatically set a slider’s current value to be below the minimum or above the maximum, it is set to the minimum or maximum instead. However, if you set the value beyond the range of the minimum or maximum in Interface Builder, the minimum or minimum values are updated instead.

===================
官方文档居然能写错,醉了。
Zaptain
2020-10-01 17:52:36 +08:00
@Building 谢谢,但我看教程上就是那样设置的,就没问题,那是大概两年前的教程,难道是版本的问题吗?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/712002

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX