设置thumbImage并观察滑块消失?
[sld1 setThumbImage:[UIImage imageNamed:@"Blue.png"] forState:UIControlStateHighlighted];
[sld1 setThumbImage:[UIImage imageNamed:@"Blue.png"] forState:UIControlStateNormal ];
这会导致滑块图像消失吗?我的都没有了(拇指图像显示得很好。)
Apple 的文档听起来好像我可以使用上述 2 行代码中的任何一个。 (但我想我真的需要两者。)
而且我找不到任何关于“你必须始终做所有 4 件事”的内容:
Set the normal-state image.
Set the highlighted-state image.
Set the setMinimumTrackImage.
Set the setMaximumTrackImage.
[sld1 setThumbImage:[UIImage imageNamed:@"Blue.png"] forState:UIControlStateHighlighted];
[sld1 setThumbImage:[UIImage imageNamed:@"Blue.png"] forState:UIControlStateNormal ];
Would that cause the slider-bar image to disappear? Mine are all gone. (The thumb-image displays just fine.)
Apple's docs make it sounds like I can use any ONE of above 2 lines of code.
(But I guess I really need both.)
And I can't find anything about "you must always do all 4":
Set the normal-state image.
Set the highlighted-state image.
Set the setMinimumTrackImage.
Set the setMaximumTrackImage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您开始使用图形自定义 UISlider,则必须设置至少 3 个图形。
轨迹栏的右侧和左侧以及拇指图像:
这是我上次使用 UISlider 时的做法:
就我的光学而言,UISlider 的突出显示状态或任何其他状态(您的手指)没有意义可能会覆盖拇指图像,因此用户永远不会看到它。
我不确定它只是从 UIButton 扩展而来,也许它无法处理它?
If you start out customizing the UISlider with graphics, you must set at least 3 pieces of graphics.
Right and left side of the trackbar and the thumb image:
Here is how I did it the last time I used the UISlider:
I my optics it does not make sense to have a highlighted state for the UISlider, or any other state, your finger will likely cover the thumb image, so the user will never see it.
I am not sure it just extends from UIButton and maybe it can't handle it?