Recipe: Creating a Twice-Tappable Segmented Control

The UISegmentedControl class presents a multiple-button interface, where users can choose one choice out of a group. The control provides two styles of use (not to be confused with UISegmentedControlStyle, which alters the control UI and has been deprecated in iOS 7). In its normal radio-button-style mode, a button once selected remains selected. Users can tap on other buttons, but they cannot generate a new event by retapping their existing choice. The alternative style, provided by the momentary Boolean property, lets users tap on each button as many times as desired but stores no state about a currently selected item. It provides no highlights to indicate the most recent selection.

Recipe ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.