In one of my views I need a control that lets the user multi-pick items on a horizontal, graphical list (tap to select, tap again to deselect...think: locking pushbuttons across the screen).

Rather than laying out a bunch of UISwitch controls side-by-side I want to use something prettier...icons of the elements being chosen. I thought a custom UITabBar might do the trick.

Is there a way to get the buttons on a UITabBar to lock state in a multi-pick fashion? So if my user taps the 1st, 2nd, and 4th buttons they stay selected but the 3rd, 5th, and 6th don't?

(If not, I guess I can build something. Can a standard UISwitch control take on a different look?)

Thanks!

有帮助吗?

解决方案

Nope, there’s nothing in the UITabBar API that indicates that you can have multiple selections.

As for customizing UISwitch—that’s not what you want. As of iOS 7 you can no longer set a custom “on” or “off” image. You’re better off customizing UIButton, which isn’t quite as close semantically, but which still provides all of the API you’ll need for your application.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top