自定义 UISlider 外观 [英] Customizing UISlider look

查看:15
本文介绍了自定义 UISlider 外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要自定义 UISlider 的视觉外观,您可以设置缩略图和轨道图像.部分轨道图像被拉伸到适当的位置.来自文档:

To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation:

一个可拉伸的区域位于两个之间端盖区域.端盖定义图像中剩余的部分按原样,不拉伸.这可拉伸区域为 1 点宽端盖之间的区域,可以是复制以使图像出现更长.

A stretchable region sits between two end cap regions. The end caps define the portions of the image that remain as is and are not stretched. The stretchable region is a 1-point wide area between the end caps that can be replicated to make the image appear longer.

现在我遇到的问题是我的可拉伸区域需要超过 1 磅宽.(这是一种模式)不幸的是,SDK 中似乎对 1 点宽度进行了硬编码.

Now the problem I have is that my stretchable region needs to be more than 1-point wide. (It's a pattern) Unfortunately the 1-point width seems to be hard coded in the SDK.

有人知道如何解决这个问题吗?还是我必须为此从头开始编写自己的滑块?

Anyone having an idea how to work around this? Or will I have to write my own slider from scratch for this?

推荐答案

我相信您必须编写自己的滑块才能做到这一点.似乎没有(公共)API 可以更改 UISlider 关于可拉伸区域的行为.

I believe you'll have to write your own slider to do that. There seems to be no (public) API to change UISlider's behavior regarding the stretchable region.

这篇关于自定义 UISlider 外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆