I want to change UISlider thumb image during the slide.
Basically to set thumbImage acording to the value.
The idea was to rotate the image according to the value and set it to the thumb.
So I tried to set the thumb image by overriding
-(BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
[self setThumbImage:[self imageRotatedByDegrees:50] forState:UIControlStateHighlighted];
and I also tried the same thing when I added an action to my slider.
Unfortunately in both implementations the image simply disappears.
Do you think it possible to achieve in the way I do it?
If NO please explain and suggest an alternative way (hopefully not one that will customize and replace the whole slider)
If Yes I will really appreciate code sample.
The more close answer that I found here
Thanks a lot.
Best Answer
I found a mistake in my Code. Apparently I was releasing one of the image before calling
CGContextDrawImage
. (I still need to improve my GUI appearance to make it more nice, for instance to make the track image as I planed I made the original one transparent and added the as subview the one I need.)with some help from this link I create an array of colours for my slider Get Pixel Color of Uiimage
}