更改UISlider的背景图像?

erdemgc

我需要更改的背景UISlider,我的目标是创建UISlider作为下图:

UISlider

我尝试了setBackgroundImage方法,但是它就像滑块的框架。

如何更改滑块的背景图像?

阿迪亚·德什曼(Aditya Deshmane)

1.在滑块下方添加具有相同尺寸的图像视图。为其设置多色图像。

2.使用透明图像作为滑块图像的左右

   UIImage *clearImage = [[UIImage imageNamed:@"clearSliderBar.png"] stretchableImageWithLeftCapWidth:14.0 topCapHeight:0.0];
    [slider setMinimumTrackImage:clearImage forState:UIControlStateNormal];
    [slider setMaximumTrackImage:clearImage forState:UIControlStateNormal];

这是用于测试的20x8样本透明图像

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章