简体   繁体   English

具有非矩形区域的Custon UISlider

[英]Custon UISlider with non rectangular area

I would like to customize my UISlider like this screenshot : 我想像这样的截图自定义我的UISlider:

alt text http://img3.imageshack.us/img3/7707/sliderp.png 替代文字http://img3.imageshack.us/img3/7707/sliderp.png

I'm using setMinimumTrackImage and setMaximumTrackImage method with a non strechable image but it doesn't work. 我正在将setMinimumTrackImage和setMaximumTrackImage方法与不可拉伸的图像一起使用,但是它不起作用。

The image is stretched and proportion are kept. 图像被拉伸并保持比例。

Any idea ? 任何想法 ?

Thanks. 谢谢。

Thierry 蒂埃里

您可以尝试将minimumTrackImage和maximumTrackImage的不可见图像都设置为透明,然后在其后面粘贴一个UIImageView。

You need to change the frame size of your slider, all your are changing are the values 您需要更改滑块的框架大小,所有更改的都是这些值

UISlider *customSlider = [[UISlider alloc] initWithFrame:CGRectMake(X,Y,Width,Heigth)];

I hope this helps 我希望这有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM