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 外观
基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01