Search code examples
iosswiftuislider

Change the size of UISlider thumb in Swift


I am new to Swift. I have a UISlider and I want to make the size of the thumb of UISlider to smaller.

I tried to set a smaller image using code :

self.setThumbImage(UIImage(named: "progress_thumb"), forState: .Normal)

But it stretches the image.

Is it because of the image I have? How can I implement thumbRectForBounds here?

Please help me.

Thanks in advance.


Solution

  • I got it solved now.It was because of the image size.When I make the image into to even smaller size, it correctly showed in the UISlider in the exact size I wanted.