How to customise UISlider height

后端 未结 9 1646
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:51

    i hope that you want edit it in storyboard, and only the line size, use it in your custom UISlider

    class CustomSlide: UISlider {
    
         @IBInspectable var trackHeight: CGFloat = 2
    
         override func trackRectForBounds(bounds: CGRect) -> CGRect {
             //set your bounds here
             return CGRect(origin: bounds.origin, size: CGSizeMake(bounds.width, trackHeight))
    
    
    
           }
    }
    

提交回复
热议问题