UISlider 在 iOS 5 中缺少轨道图像
我有一个 UISlider,我使用以下代码设置了自定义 trackImages 和thumbImage:
[progress setMinimumTrackImage:[UIImage imageNamed:@"scrubbar-inactive.png"] forState:UIControlStateNormal];
[progress setMaximumTrackImage:[UIImage imageNamed:@"scrubbar-active.png"] forState:UIControlStateNormal];
[progress setThumbImage:[UIImage imageNamed:@"scrubbar-ball.png"] forState:UIControlStateNormal];
[progress setThumbImage:[UIImage imageNamed:@"scrubbar-ball.png"] forState:UIControlStateHighlighted];
一切正常,但在 iOS 5 中我很少只得到thumbImage 而没有下面的trackImages。
I have a UISlider, and I set custom trackImages and thumbImage, using the following code:
[progress setMinimumTrackImage:[UIImage imageNamed:@"scrubbar-inactive.png"] forState:UIControlStateNormal];
[progress setMaximumTrackImage:[UIImage imageNamed:@"scrubbar-active.png"] forState:UIControlStateNormal];
[progress setThumbImage:[UIImage imageNamed:@"scrubbar-ball.png"] forState:UIControlStateNormal];
[progress setThumbImage:[UIImage imageNamed:@"scrubbar-ball.png"] forState:UIControlStateHighlighted];
Everything works fine, but in iOS 5 infrequently I get only the thumbImage and no trackImages underneath.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我确信您正在更新计时器中的
progress.value
而不是检查 NaN 值。只需以这种方式添加对 NaN 的检查:
还有一个名为
NAN
的常量,但它对我不起作用。I'm sure you're updating
progress.value
in a timer and not checking for NaN values.Just add a checking for NaN this way:
There is also a constant called
NAN
, but it didn't work for me.我之前遇到过类似的问题,轨道图像在 iOS 4 中总是显示正常,但在 iOS 5 中却不行。我尝试调整图像大小。这对我有用。请尝试这个:
I had similar problem before where the track images always show up okay in iOS 4 but not in iOS 5. I tried to make the images resizable. And it worked for me. Please try this: