自定义UISlider
1 UIImage *minImage = [[UIImage imageNamed:@"slider_minimum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; 2 UIImage *maxImage = [[UIImage imageNamed:@"slider_maximum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; 3 UIImage *thumbImage = [UIImage imageNamed:@"thumb.png"]; 4 5 [[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal]; // 6 [[UISlider appearance] setMinimumTrackImage:minImage forState:UIControlStateNormal]; 7 [[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
这将设置整个工程的UISlider外观。
1 UIImage *minImage = [[UIImage imageNamed:@"slider_minimum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; 2 UIImage *maxImage = [[UIImage imageNamed:@"slider_maximum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; 3 UIImage *thumbImage = [UIImage imageNamed:@"thumb.png"]; 4 5 [self.slider setMaximumTrackImage:maxImage forState:UIControlStateNormal]; 6 [self.slider setMinimumTrackImage:minImage forState:UIControlStateNormal]; 7 [self.slider setThumbImage:thumbImage forState:UIControlStateNormal];
这将修改本页的UISlider。