UISlider setMaximumTrackTintColor

前端 未结 6 910
情书的邮戳
情书的邮戳 2021-01-01 22:34

I\'m trying to dynamically configure the track color on a UISlider.

This line of code works perfectly for setting the low side of the slider track.

[

6条回答
  •  一向
    一向 (楼主)
    2021-01-01 22:55

    Avoid setting the maximumTrackTintColor redundantly. When my code was updating the color twice, the maximum line would just disappear. I was able to reproduce it with a simple UISlider, like this:

        UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 150, 23)];
        slider.maximumTrackTintColor = [UIColor whiteColor];
        slider.maximumTrackTintColor = [UIColor whiteColor];
    

    Instead of a white track, this slider will have no maximum track when displayed on the screen under iOS 8.

提交回复
热议问题