Home > Mobile >  Adjusting UISlider thumb image
Adjusting UISlider thumb image

Time:10-16

So I've added a thumb image to my custom UISlider like this:

self.setThumbImage(UIImage(named: "POITicker"), for: .normal)

But as you can see it's not centered. How can I adjust the image so that the the thumb is centered to the center of the circle?

enter image description here

CodePudding user response:

It's your custom slider, so override thumbRect(forBounds:...); that's what it's for.

enter image description here

Obviously, use a transparent background instead of the green shown here.

enter image description here

  • Related