添加这个:
#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];