2
votes

I have set thumb image for UISlider. This image is not reflected when i drag the slider. Once I finish the dragging then It is appearing.

I have set the image for all states

    [self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateNormal];
    [self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateSelected];
2
Setting it just for UIControlStateNormal state should be sufficient enough. Could you please check if when dragging you are not passing any empty image for thumb image or setting thumb tint colour to clear colour. Can you please post your value changed handler method. as well. - Abhinav

2 Answers

8
votes

Use UIControlStateHighlighted to Show thumb image while dragging.

like below.

[self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateHighlighted];

Hope it helps..

2
votes

You should set both images, that is while normal and also during highlight

 rangeSlider.setThumbImage(UIImage(named : "yourImage"), for: .normal)
 rangeSlider.setThumbImage(UIImage(named : "yourImage"), for: .highlighted)