Are there situations where a UIAlertView is better to use than a UIActionSheet? What are the typical scenarios where you would use one over the other?
I'm programming a navigation bar button to open a UIWebView in an external application, and at first I started programming a UIAlertView, then I thought that an action sheet might be better for this situation.
Are there any formal guidelines for which to use in different situations? Thanks.
From Apple's iPhone Human Interface Guidelines:
Alerts, action sheets, and modal views are designed to communicate different things:
- Alerts give users important information that affects their use of the application (or the device). Alerts are usually unexpected, because they generally tell users about a problem or a change in the current situation that might require users to take action.
- Action sheets give users additional choices related to the action they are currently taking. Users learn to expect the appearance of an action sheet when they tap a toolbar button that begins either a potentially destructive action (such as deleting all recent calls) or an action that can be completed in different ways (such as a send action for which users can specify one of several destinations).
- Modal views provide more extensive functionality in the context of the current task or provide a way to perform a subtask directly related to the user’s workflow.
Improving the @Brad Larson♦ answer and updating the informations (because the link in his answer is broken), here more details when you should be use an alert, an action sheet or a modal view:
Alert:
- Displays a required title and an optional message
- Contains one or more buttons
The infrequency with which alerts appear helps users take them seriously. It’s best to minimize the number of alerts your app displays, and make sure each one offers critical information and useful choices.
Action Sheet:
- Appears as the result of a user action
- Displays two or more buttons
Use an action sheet to:
- Provide alternative ways to complete a task. An action sheet lets you to provide a range of choices that make sense in the context of the current task, without giving these choices a permanent place in the UI.
- Get confirmation before completing a potentially dangerous task. An action sheet prompts users to think about the potentially dangerous effects of the step they’re about to take and gives them some alternatives.
Modal View:
- Can occupy the entire screen, the entire area of a parent view (such as a popover), or a portion of the screen
- Contains the text and controls that are necessary to complete the task
- Usually displays a button that completes the task and dismisses the view and a Cancel button that abandons the task and dismisses the view
Use a modal view when you need to offer the ability to accomplish a self-contained task related to your app’s primary function. A modal view is especially appropriate for a multistep subtask that requires UI elements that don’t belong in the main app UI all the time.
来源:https://stackoverflow.com/questions/1193379/when-to-use-a-uialertview-vs-uiactionsheet