Thumb image does not move to the edge of UISlider

后端 未结 9 1178
有刺的猬
有刺的猬 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 02:47

    Instead of

    [self.slider setMinimumTrackImage:sliderBarMinImage forState:UIControlStateNormal];
    [self.slider setMaximumTrackImage:sliderBarImage forState:UIControlStateNormal];
    [self.slider setThumbImage:sliderThumbImage forState:UIControlStateNormal];
    

    Try setting the appearance proxy like this

    [[UISlider appearance] setMinimumTrackImage:sliderBarMinImage forState:UIControlStateNormal];
    [[UISlider appearance] setMaximumTrackImage:sliderBarImage forState:UIControlStateNormal];
    [[UISlider appearance] setThumbImage:sliderThumbImage forState:UIControlStateNormal];
    

提交回复
热议问题