When to use a UIAlertView vs. UIActionSheet

前端 未结 2 814
小蘑菇
小蘑菇 2020-12-28 15:11

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 programmi

相关标签:
2条回答
  • 2020-12-28 15:55

    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.
    0 讨论(0)
  • 2020-12-28 16:04

    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.

    Source: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Alerts.html

    0 讨论(0)
提交回复
热议问题