Modality is a design technique that presents content in a temporary mode that requires an explicit action to exit. Presenting content modally can:

    • Help people focus on a self-contained task or set of closely related options
    • Ensure that people receive critical information and, if necessary, act on it

    模态是一种设计手段,在临时展示的可退出模式下短暂出现相应的内容。展示的模块化内容可以:

    • 帮助人们专注于当前任务或是与当前密切相关的选项
    • 确保用户收到关键信息,在必要条件下需要进行操作(才能继续)
    • 截屏2022-05-27 上午10.46.25.png

    To enable various system-defined modal experiences, iOS provides alerts, activity views, share sheets, and action sheets. To present custom modal content in your app, you can use one of the following presentation styles.
    为了实现多种系统定义的模态体验,ios提供了 alerts,activity views,share sheets,和action sheets。为了在你的应用中展示自定义的模态内容,你可以使用以下的展示风格(styles?)

    • Automatic. Uses the default presentation style, typically a sheet.
    • Fullscreen. Covers the previous view, and requires a button for dismissal.
    • Popover. Presents a popover in a horizontally regular environment and a sheet in compact environments.
    • Page sheet and form sheet. Partially covers the previous view; for guidance, see Sheets.
    • Current context. Covers a particular previous view.
    • Custom. Uses custom animation to present content in a custom container.

    • 自动化(常规的?)。使用默认的展示样式,通常是sheet

    • 全屏的。覆盖之前的页面,并提供返回按钮
    • 弹窗。在横屏环境下展示弹窗并在竖屏环境下展示sheet
    • 页面sheet和表单sheet。部分得覆盖了之前的页面试图,作为引导可以查看 Sheets.
    • 当前内容。覆盖部分当前页面内容
    • 定制。使用定制化的动效展示在定制容器中的当前内容

    For developer guidance, see UIModalPresentationStyle.

    NOTEIf you use the current context modal view style to display modal content within a split view pane, popover, or other view that isn’t fullscreen, switch to using a sheet when presenting modal content in a compact environment.

    Use modality when it makes sense. Create a modal experience only when it’s critical to focus people’s attention on making a choice or performing a task that’s different from their current task. A modal experience takes people out of their current context and requires an action to dismiss, so it’s essential to use it only when it provides a clear benefit.
    只有在必要时使用模态。只有在为了吸引用户在做出选择的时候或者当用户在完成有别于当前任务的行为时,才可以使用模态。使用模态会让用户暂时离开当前内容并(所以?)需要提供一个退出的按钮(action),所以只要当前操作能提供足够清晰的好处是才有必要使用模态

    Reserve alerts for delivering essential — and ideally actionable — information. Typically, an alert appears because something has gone wrong. Because an alert interrupts the current experience and requires a tap to dismiss, it’s important for people to feel that the intrusion is warranted. For guidance, see Alerts.
    为提供重要信息(ideally actionable)保留警告。首先警告的出现是因为出错了。因为警告会打断当前的操作并需要开关(按钮?)来关闭它。对用户来说感觉到被打断是有必要的这件事是很重要的。作为引导可查看Alerts.

    In general, keep modal tasks simple, short, and narrowly focused. If a modal task is too complicated, people can lose sight of the task they suspended when they entered the modal context. Take care to avoid creating a modal experience that feels like an app within your app. In particular, be wary of presenting a hierarchy of views within a modal task, because people can forget how to retrace their steps to their original task. If a modal task must contain subviews, provide a single path through the hierarchy and a clear path to completion. Avoid using a Done button for anything other than completing the task.
    一般来说,需要保证模态任务保持简单,间断和聚焦。如果一个模态任务过于复杂,当用户进入到模态内容时他们会忘记当前进行的主流程。你要注意避免创造出那种像是使用APP的模态体验(过于复杂),特别是需要警惕展示出带有模态任务的视图结构,因为用户可能会忘记如果回到他们之前的操作中。如果一个模态任务必须包含子视图,通过提供简单的视觉层次和清晰的路径去实现。避免使用一个done 按钮来表示所有任务完成操作。

    Consider using a fullscreen modal style for immersive content or a complex task. A fullscreen modal experience minimizes distractions, so it can work well for presenting videos, photos, or camera views, or to enable a multistep task like marking up a document or editing a photo.

    考虑使用全屏的模态样式来展示沉浸式的内容或者复杂的任务。全屏的模态体验可以最小化干扰,所以他可以很好得展示出视频,图片以及相机页面或者可以暂时像是标记文档、编辑图片这样的复杂任务

    Always include a button that dismisses the modal view. For example, you might use Done or Cancel. Including a button ensures that the modal view is accessible to assistive technologies and provides an alternative to dismissal gestures.
    一直保证有一个按钮可以退出模态视图。举个例子,你可能会使用Done或者Cancel的按钮,提供一个能帮助用户继续的操作和一个退出的操作

    When necessary, help people avoid data loss by getting confirmation before closing a modal view. Regardless of whether people use a dismiss gesture or a button to close the view, if the action could result in the loss of user-generated content, present an action sheet that explains the situation and gives people ways to resolve it.

    当在有必要时,为帮助人们避免数据损失,可以在其关闭模态视图之前提醒用户确认一遍。不论是用户使用退出手势或者关闭按钮,如果该操作会使得用户当前操作内容丢失,需要展示一个操作sheets来提示这个情况并且给予用户一个能弥补的机会

    Make it easy to identify a modal view’s task. When people enter a modal view, they switch away from their previous context and might not return to it right away. When you provide a title that names the modal view’s task — or additional text that describes the task or provides guidance — you can help people keep their place in your app.
    让人们可以容易辨别当前模态视图的任务内容。当人们进入一个模态视图时,用户从他们当前的内容离开并可能无法快速回到当前内容。若您能提供模态任务页面的标题或者额外能描述当前任务的文本/指导,你就可以帮助用户在你的应用中定位当前位置(体验上的)

    Coordinate the modal view’s appearance with your app. For example, when a modal view includes a navigation bar, it should use the same appearance as the navigation bar in your app.
    统一应用中的模态页面的视觉样式。举个例子,当你的模态页面包含导航栏时,它应该使用应用中同样视觉样式的导航栏

    Choose a modal transition style that makes sense in your app. Use a transition style that coordinates with your app and enhances the awareness of the temporary context shift. The default transition vertically slides the modal view up from the bottom of the screen and back down when it’s dismissed. Use consistent modal transition styles throughout your app.
    For developer guidance, see UIViewController and UIPresentationController.

    选择适用你应用的模态转化形式。使用转化形式可以统一你应用中与临时内容衔接的情况。在纵向的适配下默认的转化模式事从屏幕底部移除消失的。在你的应用中使用统一的模态转化形式。作为指南可以看 UIViewController and UIPresentationController.