Best radio-button implementation for IOS
I would like to ask if there are examples out there on how to implement radio-button options on an iPhone app.
I find the Picker View quite big for a simple selection feature.
I'm not sure if Apple excluded radio buttons on purpose, and whether if it is better to simply use a Picker View from a usability / user experience point-of-view.
I have some thoughts on how the best radio button implementation should look like. It can be based on UIButton
class and use it's 'selected' state to indicate one from the group. The UIButton
has native customisation options in IB, so it is convenient to design XIBs.
Also there should be an easy way to group buttons using IB outlet connections:
I have implemented my ideas in this RadioButton class. Works like a charm:
Download the sample project.
Try UISegmentedControl. It behaves similarly to radio buttons -- presents an array of choices and lets the user pick 1.
Just want to sum up, there might be 4 ways.
- If you don't have much space, add a click event for text or button, then show UIPickerView:
or open a new table view control with a check mark:
- If there is more space, add a table view directly to your main view:
- The final solution is using UISegmentedControl:
Hope this helps.