UISlider behaviour in iOS7 versus iOS6

梦想的初衷 提交于 2019-11-30 05:06:35

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];

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];

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!