UISlider behaviour in iOS7 versus iOS6

前端 未结 3 986
不知归路
不知归路 2020-12-29 11:46

I noticed that UISlider in iOS7 behaves differently than it did in iOS 6 and iOS 5:

Say you have a slider with min=0 and max=10, current value is 0. When you first t

相关标签:
3条回答
  • 2020-12-29 11:54

    On iOS 9 you need to set for .Normal, .Selected and .Highlighted states to work. I found this after 5h of struggling. Way to go Apple!

    [_sliderView setThumbImage:[UIImage imageNamed:@"knob"] forState:UIControlStateNormal];
    [_sliderView setThumbImage:[UIImage imageNamed:@"knob"] forState:UIControlStateSelected];
    [_sliderView setThumbImage:[UIImage imageNamed:@"knob"] forState:UIControlStateHighlighted];
    
    0 讨论(0)
  • 2020-12-29 12:01

    Apple has not commented on my bug report yet, but I've found a solution more or less by accident: installing a custom image for the knob restores the behaviour from iOS 6:

    [self.slider setThumbImage:[UIImage imageNamed:@"knob"] forState:UIControlStateNormal];
    
    0 讨论(0)
  • 2020-12-29 12:10

    I tested it and can confirm the described behavior.

    Interestingly, when the app is built using the iOS 6 SDK but the device/simulator still runs iOS 7 (in compatibility mode) the bug does not occur. So it seems that it's connected to the new look.

    File a bug.

    0 讨论(0)
提交回复
热议问题