V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Zaptain
V2EX  ›  iOS

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

  •  
  •   Zaptain · 2020-09-30 22:42:24 +08:00 · 1012 次点击
    这是一个创建于 1309 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    3 条回复    2020-10-01 17:52:36 +08:00
    Building
        1
    Building  
       2020-10-01 15:39:18 +08:00 via iPhone
    我记得 UISlider 值域好像就是 0 ~ 1
    Building
        2
    Building  
       2020-10-01 15:42:43 +08:00 via iPhone
    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
        3
    Zaptain  
    OP
       2020-10-01 17:52:36 +08:00
    @Building 谢谢,但我看教程上就是那样设置的,就没问题,那是大概两年前的教程,难道是版本的问题吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   817 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:22 · PVG 06:22 · LAX 15:22 · JFK 18:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.