Thumb image does not move to the edge of UISlider

后端 未结 9 1194
有刺的猬
有刺的猬 2021-02-13 02:14

Thumb image does not move to the edge even when it\'s value is max or min.

Does anyone know how to make it move all the way to the edge of the slider?

9条回答
  •  無奈伤痛
    2021-02-13 03:07

    I recently had to deal with customization of the slider (subclassed), including adding tickmarks on the slider. Thumb image is not centered on the value and since you replaced image it is positioned where it is supposed to be according to implementation. In order to do what you are trying to do I had to adjust position of the thumb image using

    - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value
    

提交回复
热议问题