我有一个自定义UISlider
图片用于我的轨道填充,但它超出了轨道的范围。
以下是 AppDelegate.m
中的代码UIImage *minImage = [[UIImage imageNamed:@"slider-track-fill.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
UIImage *maxImage = [UIImage imageNamed:@"slider-track.png"];
UIImage *thumbImage = [UIImage imageNamed:@"slider-cap.png"];
[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[[UISlider appearance] setMinimumTrackImage:minImage forState:UIControlStateNormal];
[[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
[[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateHighlighted];
http://imgur.com/wI0RXGq - 这是我加载应用时的外观
答案 0 :(得分:1)
您可能只想将剪辑设置为bounds = YES。
self.slider.clipsToBounds = YES;