xcode 自定义 UI 滑块,拇指图像大小问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14597635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Custom UI slider , Thumb image size issue
提问by Prateek sharma
As I'm making a custom slider , Every thing is working fine . As I have an thumb image having width and height of 30x70. But when i implement the image it change its orientation by itself and displaying in 70x30 .
当我制作自定义滑块时,一切正常。因为我有一个宽度和高度为 30x70 的拇指图像。但是当我实现图像时,它会自行改变方向并以 70x30 显示。
I tried changing the image also but the Thumb slider comes in 70x30. I want to show image in vertical but it displays in horizontal in UISlider
.
我也尝试更改图像,但 Thumb 滑块是 70x30。我想以垂直方式显示图像,但在UISlider
.
Can any one help?
任何人都可以帮忙吗?
[self setThumbImage:[UIImage imageNamed:@"slider.png"] forState:UIControlStateNormal];
回答by bhavya kothari
If you want change UISlider appearance then use below method
[[UISlider appearance] setThumbImage:[UIImage imageNamed:@"slider.png"]
forState:UIControlStateNormal];
如果您想更改 UISlider 外观,请使用以下方法
[[UISlider appearance] setThumbImage:[UIImage imageNamed:@"slider.png"]
forState:UIControlStateNormal];