Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. Building and Using Controls > Recipe: Creating a Twice-Tappable Segm...

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. 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 momentary style 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 9-4 builds a hybrid approach. It allows users to see their currently selected option and to reselect that choice if needed. This is not the way segmented controls normally work. There are times, though, when you want to generate a new result on reselection (as in momentary mode) while visually showing the most recent selection (as in radio button mode).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial