如何设置 UISegmentedControl 的背景图像

发布于 2024-12-12 01:53:34 字数 460 浏览 0 评论 0原文

我有一个带有分段控件的视图,我想设置该控件的背景图像。我知道我可以更改设置色调颜色,但我想要对其进行更多控制。所以如果我能设置一个背景图片那就太酷了。

我找到了有关如何实现此目的的教程,但是它已经过时了,我无法让它发挥作用。

有人可以帮我吗?我非常感谢任何帮助。

UPDATE

解决方案已找到一半,如果唯一需要支持的是 iOS5,您可以使用 setBackgroundImage:forState:barMetrics:。 可以在此处找到有关此问题的精彩教程。

I have a view with a segmentedcontrol in it and I would like to set the background image of that control. I know that I can change set the tint color, but I want more control over it than that. So if I could set a background image that would be cool.

I found this tutorial on how to achieve this, however it's outdated, and I'm unable to get it working.

Could anyone please help me? I greatly appreciate any help.

UPDATE

Half the solution has been found, if the only thing one needs to support is iOS5 you can use setBackgroundImage:forState:barMetrics:. A great tutorial on the matter can be found here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囚我心虐我身 2024-12-19 01:53:34

这个怎么样?: setBackgroundImage:forState:barMetrics:

直接来自文档

注意:适用于 iOS 5.0 及更高版本。

How about this?: setBackgroundImage:forState:barMetrics:

Straight from the docs

Note: Available in iOS 5.0 and later.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文