Search code examples
iphoneuisegmentedcontrol

How can I enable multiple segments of a UISegmentedControl to be selected?


Lets say my UISegmentedControl has 8 numbered segments. I would like for the user to be able to turn on 2, 3, or more of them at once. Toggling them. Essentially like a bits in a byte. Is this possible? I believe it is on regular Mac OS X but I can't seem to find a way to do it in the iPhone SDK.

If I have to simulate this by putting buttons into a view, is there any way to do the following:

  1. Round the corners of the view so that it looks like the "bar" style UISegmentedControl?
  2. Use the built-in backgrounds the "bar" style has on the buttons?
  3. Give the buttons a shadow like the whole "bar" style has? (not the text)

Solution

  • This isn't possible using UIKit. I would recommend creating a custom control, or an array of UISwitch controls, representing each of the options in your UISegmentedControl.