// // IHSlider.swift // Inhealth // // Created by weclouds on 2020/1/9. // Copyright © 2020 weclouds. All rights reserved. // import UIKit class IHSlider: UISlider { let defaultThumbSpace:Float = 10 lazy var startingOffset : Float = 0 - defaultThumbSpace lazy var endingOffet : Float = 2 * defaultThumbSpace override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect { let xTranslation = startingOffset + (minimumValue + endingOffet) / maximumValue * value return super.thumbRect(forBounds: bounds, trackRect: rect.applying(CGAffineTransform(translationX: CGFloat(xTranslation), y: 0)), value: value) } }