How to make UISlider default thumb to be smaller like the ones in the iOS control center

后端 未结 5 588
孤独总比滥情好
孤独总比滥情好 2021-02-01 06:50

I\'m working on an app and I have a custom UISlider.
However, I\'m having some issues on how to make the default thumb to appear smaller like t

5条回答
  •  感情败类
    2021-02-01 07:55

    1. Download an image similar to the one you have in the iOS control centre.

    2. Scale it to the size you want (20x20 or even smaller) and save it in your assets.

    3. Paste the following code in viewDidLoad:

      self.yourSlider.setThumbImage(UIImage(named: "SliderName")!, for: .normal)
      

提交回复
热议问题