我需要更改的背景UISlider
,我的目标是创建UISlider作为下图:
我尝试了setBackgroundImage
方法,但是它就像滑块的框架。
如何更改滑块的背景图像?
1.在滑块下方添加具有相同尺寸的图像视图。为其设置多色图像。
2.使用透明图像作为滑块图像的左右
UIImage *clearImage = [[UIImage imageNamed:@"clearSliderBar.png"] stretchableImageWithLeftCapWidth:14.0 topCapHeight:0.0];
[slider setMinimumTrackImage:clearImage forState:UIControlStateNormal];
[slider setMaximumTrackImage:clearImage forState:UIControlStateNormal];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句