Fixes #26. A way to change (all) ticks color of discrete slider: tickTintColor

This commit is contained in:
Xavier Schott 2018-05-31 13:40:08 -07:00
parent c216edf971
commit bcc249901a
1 changed files with 9 additions and 2 deletions

View File

@ -71,6 +71,12 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
}
}
@IBInspectable public var tickTintColor:UIColor? = nil {
didSet {
layoutTrack()
}
}
@IBInspectable public var tickImage:UIImage? = nil {
didSet {
layoutTrack()
@ -309,8 +315,9 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
func drawTicks() {
ticksLayer.frame = bounds
if let backgroundColor = tintColor {
ticksLayer.backgroundColor = backgroundColor.cgColor
if let tickColor = tickTintColor ?? tintColor {
ticksLayer.backgroundColor = tickColor.cgColor
}
let path = UIBezierPath()