Chapter 26. Modal Dialogs
A modal dialog demands attention; while it is present, the user can do nothing other than dismiss the dialog. You might need to put up a simple modal dialog in order to give the user some information or to ask the user how to proceed. Two UIView subclasses are provided that construct and present rudimentary modal dialogs:
- UIAlertView
- A UIAlertView pops up unexpectedly with an elaborate animation and may be thought of as an attention-getting interruption. An alert is displayed in the center of the screen; it contains a title, a message, and an indefinite number of additional buttons, one of which may be the cancel button, meaning that it does nothing but dismiss the alert. The cancel button appears last, slightly separated from the other buttons. Often there is only a cancel button, the primary purpose of the alert being to show the user the message (“You won the game”); the additional buttons may be used to give the user a choice of how to proceed (“You won the game; would you like to play another?” “Yes,” “No,” “Replay”).
- UIActionSheet
- A UIActionSheet may be considered the iOS equivalent of a Mac OS X menu. An action sheet is displayed arising from the interface: on the iPhone, it slides up from the bottom of the screen; on the iPad, it is typically shown in a popover. It consists of an indefinite number of buttons (there can be a title, optionally, but there usually isn’t); one may be the cancel button, which appears last (though on the iPad, for ...
Get Programming iOS 4 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.