補充一點:
#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];
我的問題是不是IOS版本。相反,它會問爲什麼跟蹤圖像消失? – fibnochi 2013-02-28 14:28:18
注意'resizableImageWithCapInsets:'方法。它解決了重複的圖像問題。而且你沒有設置強調拇指狀態。 – pbibergal 2013-02-28 14:51:54