简体   繁体   中英

How do I set the background image of a UISegmentedControl

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.

How about this?: setBackgroundImage:forState:barMetrics:

Straight from the docs

Note : Available in iOS 5.0 and later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM