How to customise UISlider height

后端 未结 9 1649
Happy的楠姐
Happy的楠姐 2020-12-06 05:42

I have project in which have to customise UISlider element. I wondering if someone knows how to change, or is it possible to change height of UISlide

9条回答
  •  眼角桃花
    2020-12-06 05:56

    Swift 3

    class MySlide: UISlider {
    
        @IBInspectable var height: CGFloat = 2        
        override func trackRect(forBounds bounds: CGRect) -> CGRect {
            return CGRect(origin: bounds.origin, size: CGSize(width: bounds.width, height: height))
        }
    }
    

提交回复
热议问题