【问题标题】:How to change the size of a UISlider thumb when seeking查找时如何更改 UISlider 拇指的大小
【发布时间】:2020-07-05 23:56:04
【问题描述】:

我想让我的 UISlider 拇指大小在我滑动滑块时改变,就像搜索器在 Apple Music 或 Spotify 中的工作方式一样。这可能与香草UISlider有关吗?任何有关如何执行此操作的指示将不胜感激。谢谢

【问题讨论】:

    标签: ios swift animation uikit uislider


    【解决方案1】:

    使用您想要的 PDF 大小创建一个普通且更大的拇指图像,并将其添加到 .xcassets。

    然后使用以下代码行:

    let normal = UIImage(named: "thumbSmall")
    slider.setThumbImage(normal, for: .normal)
    let highlighted = UIImage(named: "thumbLarger")
    slider.setThumbImage(highlighted, for: .highlighted)
    

    然后在滑动过程中显示较大的拇指图像。

    一个简短的测试如下所示:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-17
      • 1970-01-01
      • 2012-03-30
      • 1970-01-01
      相关资源
      最近更新 更多