如何删除 UISlider 控件左侧的蓝色阴影?
有没有办法轻松删除 UISlider 控件左侧的蓝色阴影,或者我是否需要使用自定义图形?
非常感谢
Is there a way to easily remove the blue shading from the left side of a UISlider control or do I need to use a custom graphic?
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于你所说的“容易”是什么意思。如果您的意思是在 UISlider 对象上设置属性,那么我认为答案是否定的。
不过,使用自定义图形并不困难,所以尝试一下吧。有很多免费的工件可以用于滑块的左侧和右侧。它们在文档中被称为最小和最大轨道图像。
加载图像时需要记住的是执行以下操作:
可拉伸图像位是需要注意的重要事项。 leftCapWidth:5 是图像的不可拉伸部分(宽度方向) - 在默认图像的情况下,它是左侧的圆形部分。假设蓝色条的可拉伸位为 1 像素宽,因此在我们的例子中为第 6 个像素。图像的其余部分被假定为右圆角位(如果滑块处于最大值,则仅在拇指下方绘制)。
Depends on what you mean by "easily". If you mean as in setting a property on the UISlider object then I think the answer is no.
Using custom graphics is not that difficult though, so have a go. There are plenty of free artifacts out there that you can use for the left and right side of the slider. They are referred to as minimum and maximum track image in the documentation.
What you need to remember when loading the image is to do something like this:
The stretchable image bit is the important thing to note. The leftCapWidth:5 is the non-stretchable part (width-wise) of the image - in the case of the default image it is the rounded part of the left side. The stretchable bit which is the blue bar is assumed to be 1 pixel wide, so in our case the 6th pixel. The rest of the image is assumed to be the right rounded bit (only drawn below the thumb if the slider is at the maximum value).