何时使用 UIAlertView 与 UIActionSheet

发布于 2024-07-30 00:58:25 字数 191 浏览 6 评论 0原文

是否存在 UIAlertView 比 UIActionSheet 更好用的情况? 您会使用其中一种而不是另一种的典型场景是什么?

我正在编写一个导航栏按钮以在外部应用程序中打开 UIWebView,首先我开始编写 UIAlertView,然后我认为操作表可能更适合这种情况。

是否有可在不同情况下使用的正式指南? 谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东走西顾 2024-08-06 00:58:26

来自 Apple 的 iPhone 人机界面指南

警报、操作表和模式视图
旨在传达不同的信息
事情:

  • 提醒为用户提供影响其使用的重要信息
    应用程序(或设备)。
    警报通常是意外的,因为
    他们通常会告诉用户一个
    问题或当前的变化
    可能需要用户的情况
    采取行动。
  • 操作表为用户提供与其所执行的操作相关的更多选择
    目前正在服用。 用户学会
    期待动作的出现
    当他们点击工具栏按钮时的工作表
    这要么开始一个潜在的
    破坏性行为(例如删除
    所有最近的通话)或某个操作
    可以通过不同的方式完成
    (例如用户的发送操作
    可以指定几个之一
    目的地)。
  • 模态视图在上下文中提供了更广泛的功能
    当前任务或提供一种方法
    执行与直接相关的子任务
    用户的工作流程。

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.
友欢 2024-08-06 00:58:26

改进@Brad Larson 答案并更新信息(因为他的答案中的链接已损坏),这里有更多详细信息,当您应该使用警报、操作表或模式视图时:

提醒:

  • 显示必填标题和可选消息
  • 包含一个或多个按钮

警报出现的频率较低,有助于用户认真对待它们。 最好尽量减少应用显示的警报数量,并确保每个警报都提供关键信息和有用的选择。

操作表:

  • 作为用户操作的结果显示
  • 显示两个或更多按钮

使用操作表可以:

  • 提供完成任务的替代方法。通过操作表,您可以提供一系列在当前任务的上下文中有意义的选择,而无需在用户界面中永久保留这些选择的位置.
  • 在完成潜在危险的任务之前获得确认。操作表会提示用户考虑他们即将采取的步骤的潜在危险影响,并为他们提供一些替代方案。

模态视图:

  • 可以占据整个屏幕、父视图的整个区域(例如弹出窗口)或屏幕的一部分
  • 包含完成任务所需的文本和控件
  • 通常显示一个完成任务并关闭视图的按钮和一个放弃任务并关闭视图的取消按钮

当您需要提供完成与应用主要功能相关的独立任务的能力时,请使用模态视图。 模态视图特别适合需要始终不属于主应用 UI 的 UI 元素的多步骤子任务。

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文