I am changing the color of a UISlider by calling .thumbTintColor
@IBAction func slider1Master(sender: AnyObject) {
slider1.thumbTintColor = UIColor.orangeColor()}
It works, but I want the color to change back to it's original state when the touch ends (user lifts finger).
Does anyone have any suggestions? Thank you.
You can use "setThumbImage" instead. Then you have the option of setting an image for a specific state of action. For the image, just create a rounder image with the color you desire.
You can safely accept McMatan’s solution as your answer. It is good for several reasons.
UISlider
UIButtons
and circularUIViews
.UISlider
design elements (if so desired).The code below does just that. I used McMatan’s
UIImage extension
with no changes other than translation to Swift 3. But I have split his functionsetUpSlider()
into two, one for drawing the circular image in its default state, the other for drawing it in its highlighted state.By accepting McMatan’s solution, you will encourage those who contribute their experience and free time to continue making this forum worthwhile for the rest of us. So please do.
Extension translated to Swift 3