UISlider进度条两边有空隙的解决办法(swift)

 override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect {
 let newRect = CGRect(x: rect.origin.x - 10, y: rect.origin.y, width: rect.size.width + 20, height: rect.size.height)
        
 return  super.thumbRect(forBounds: bounds, trackRect: newRect, value: value).insetBy(dx: 10, dy: 10)
    } 

OC版写法 : http://www.jianshu.com/p/933203265772

你可能感兴趣的:(UISlider进度条两边有空隙的解决办法(swift))