Customizing UISlider look(自定义 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 外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:自定义 UISlider 外观
基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
