iOS Custom Slider remove min and max space from both ends

后端 未结 1 1771
走了就别回头了
走了就别回头了 2021-01-26 04:24

I\'m trying to make custom slider using

class MySlider: UISlider {

    override func trackRect(forBounds bounds: CGRect) -> CGRect {
        let customBounds         


        
相关标签:
1条回答
  • 2021-01-26 04:40

    I was able to achieve this without subclassing:

    Set Thumb Tint: Default through IB

    @IBOutlet weak var slider: MySlider!
        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
            let size = CGSize(width: 1 , height: 1)
            UIGraphicsBeginImageContext(size)
            let finalImage = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();
            slider.setThumbImage(finalImage, for: .normal)
        }
    
    0 讨论(0)
提交回复
热议问题