gpt4 book ai didi

iphone - UISlider 轨道图像在滑动时消失

转载 作者:行者123 更新时间:2023-11-28 18:38:20 25 4
gpt4 key购买 nike

我有一段创建自定义 UISlider 的代码。当我快速滑动到最后时,left_image.png 不显示,但如果我不滑动,它工作正常。

[sliderFPS setMinimumTrackImage:[UIImage imageNamed:@"left_slider.png"]
forState:UIControlStateNormal];
[sliderFPS setMaximumTrackImage:[UIImage imageNamed:@"right_slider.png"]
forState:UIControlStateNormal];

[sliderFPS setThumbImage:[UIImage imageNamed:@"thumb_slider.png"]
forState:UIControlStateNormal];

我已经花了 2 个多小时,但找不到任何解决方案。任何帮助将不胜感激。

最佳答案

添加这个:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0"))
{
[[UISlider appearance] setMinimumTrackImage:[[UIImage imageNamed:@"ios6_slider_minimum_value"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 0)] forState:UIControlStateNormal];
[[UISlider appearance] setMaximumTrackImage:[[UIImage imageNamed:@"ios6_slider_maximum_value"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 10)] forState:UIControlStateNormal];
}
else
{
[[UISlider appearance] setMinimumTrackImage:[[UIImage imageNamed:@"slider_minimum_value"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 0)] forState:UIControlStateNormal];
[[UISlider appearance] setMaximumTrackImage:[[UIImage imageNamed:@"slider_maximum_value"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 0)] forState:UIControlStateNormal];
}

[[UISlider appearance] setThumbImage:[UIImage imageNamed:@"slider_button"] forState:UIControlStateNormal];
[[UISlider appearance] setThumbImage:[UIImage imageNamed:@"slider_button"] forState:UIControlStateHighlighted];

关于iphone - UISlider 轨道图像在滑动时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15137335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com