srivatsa
srivatsa

Reputation: 117

How to apply multiple colors to a uislider's track without moving sliders thumb tint?

How to change Uislider trackcolor with gradient color which shows in below image gray and black.

enter image description here

Upvotes: 1

Views: 353

Answers (1)

Mojtaba Hosseini
Mojtaba Hosseini

Reputation: 119302

1. Add an imageView with the gradient image or gradientView (using CAGradientLayer) below the slider.

2. Align it with the slider.

3. Clear color you don't want to see.

slider.minimumTrackTintColor = .clear
slider.maximumTrackTintColor = .clear

Upvotes: 1

Related Questions