Search code examples
iosswiftuikituislider

Slider with process of loading track


I have to do AVPlayer with UISlider. But there is a problem. I know how to make a slider gray and blue, but I don't know how to add on slider this light blue line, which shows progress of loading track enter image description here

Code for default left line:

self.tintColor = .blue
self.maximumTrackTintColor = .gray
self.minimumValue = minValue
self.value = currentValue
self.maximumValue = maxValue

How to control light blue line? How to add it?


Solution

  • As of me UISlider doesn't have any property that can resolve your problem. I've achieved the same UISlider by making some customisation.

    Just place your UISlider immediately on top of your UIProgressView and make them the same size in Interface Builder place.

    On a UISlider the background horizontal line is called the track, the trick is to make it invisible. We do this with a transparent PNG and the UISlider methods setMinimumTrackImage() and setMaximumTrackImage().