I wish this help you You can do this without adding/managing your own subviews, but you will need custom images. You can use the setMinimumTrackImage:forState and setMaximumTrackImage:forState which are built in properties of the UISlider API. The minimum image will show from the minimum end of the slider to the thumb image, and the maximum image will show from the thumb image to the maximum end of the slider. So you could either make these the same, or different, depending on the effect you want to create. Customizing the slider's appearance Apple reference
Plot Multicolored line based on conditional in python
will help you Here's an example of what I think your trying to do. It's based on the MPL documentation mentioned in the comments and uses randomly generated data. Just map the colormap boundaries to the discrete values given by the number of classes.