自定义滑块轨道图像
您好,我想自定义我的 UISlider,类似于 iBooks 的方式。我知道 [滑块 setMaximumTrackImage:] 和 [滑块 setMinimumTrackImage:] 但是有人可以澄清我在图像中需要多少个点吗?
Hi i would like to customize my UISlider similar to the way iBooks has done. I Know that
[slider setMaximumTrackImage:] and [slider setMinimumTrackImage:]
are to be used.But can someone clarify as to how many dots would i need in the image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
图像应该是可拉伸的。来自文档:
因此,您绘制的图像将具有结束部分(默认滑块中最左侧的圆形部分) - 其宽度由左大写宽度定义。然后是一个 1 像素宽的部分,可以拉伸到滑块的长度,然后是右盖(占据图像的剩余部分)。
理论上,您可以制作一个一像素宽的图像,并且该图像只会从轨道末端拉伸到当前拇指位置。然而,这最终没有任何形状。
The images are supposed to be stretchable. From the docs:
So, the image you draw would have your end part (the rounded part on the far left in the default slider) - the width of this is defined by your left cap width. Then a 1-pixel wide part which can be stretched to the length of the slider, then a right cap (which takes up the remaining part of the image).
In theory then you could make a one-pixel wide image and this would just be stretched out from the end of the track to the current thumb position. However, this would have no shape at the end.