A sheet helps people perform a distinct task that’s related to the parent view without taking them away from their current context. For example, Mail uses a sheet to help people compose an email without leaving their mailboxes, and Translate uses a sheet to display a dictionary view that helps people define the word they want to translate.
    工作表可以帮助人们执行与父视图相关的子任务,而不会将其带离当前上下文。例如,Mail功能使用工作表来帮助人们在不离开邮箱页面的情况下撰写电子邮件,而Translate功能使用工作表来显示字典视图,帮助人们解释他们想要翻译的单词。

    image.png
    A sheet appears as a card that partially covers the underlying content. The card’s top corners are rounded to visually distinguish it from the parent view. You can customize a sheet’s corner radius to coordinate with the corner radii you use elsewhere in your app; for developer guidance, see preferredCornerRadius.
    工作表以卡片的形式出现,会覆盖部分底层内容。卡片的上角是圆角的,以在视觉上与父视图区分。你可以自定义工作表的圆角,使其与应用程序中的其他圆角相协调。

    People typically expect to resize a sheet when they scroll its contents or drag the grabber, which is a small horizontal indicator that can appear at the top edge of a sheet. In iOS 15 and later, sheets resize according to their detents, which are particular heights at which a sheet naturally rests. The system defines two detents: large is the height of a fully expanded sheet and medium is about half the fully expanded height.
    人们会通过滚动内容或拖动抓取器调整工作表的大小(抓取器是一个可以出现在工作表顶部边缘的小水平指示器)。在iOS 15及之后的版本中,工作表根据制动器调整大小(制动器是卡单自然停留的特定高度)。系统定义了两个制动器:大的是高度完全展开的工作表,小的是大约一半的展开高度。
    image.png
    image.png
    Sheets automatically support the large detent. Adding the medium detent allows the sheet to rest at both heights, whereas specifying only medium prevents the sheet from expanding to full height. For developer guidance, see detents.
    工作表默认支持大制动器。添加中号制动器能让工作表在两个高度静止,而仅使用中号制动器可防止工作表拓展到全高度。

    By default, a sheet is modal, presenting a focused experience that dims the parent view and prevents interaction with it. After people finish interacting with a modal sheet, they dismiss it — or it dismisses automatically — before resuming their task in the parent view. In iOS 15 and later, a sheet can also be nonmodal. When a nonmodal sheet is onscreen, people can continue their task in the parent view while also interacting with the sheet.
    默认情况下,工作表是一个聚焦的模态体验,它使父视图变暗以阻断交互。在人们完成与工作表的交互之后,他们会在回到父视图继续任务之前退出它——或者它会自动退出。在ios15及以后版本中,工作表也可以是非模态的。当一个非模态工作表出现在屏幕上时,人们可以在父视图中继续他们的任务,同时也与工作表交互。

    Use a sheet for nonimmersive content and simple tasks. A sheet allows part of the parent view to remain visible behind it, helping people retain their original context as they interact with the sheet. Use a full-screen modal presentation to offer immersive content such as videos, photos, or camera views, or to enable a complex task such as marking up a document or editing a photo. The full-screen modal style covers the entire screen, minimizing visual distraction. For developer guidance, see UIModalPresentationStyle.fullScreen.
    使用工作表完成非沉浸式内容和简单任务。工作表允许父视图的一部分在它后面保持可见,以帮助人们在与工作表交互时保持原始上下文。使用全屏模态的呈现方式来提供沉浸式内容(如视频、照片或相机视图),或支持复杂任务(如标记文档或编辑照片)。全屏模态样式覆盖整个屏幕,最大限度地减少视觉干扰。

    Consider supporting the medium detent to allow progressive disclosure of the sheet’s content. For example, a share sheet displays the most relevant items within the medium detent, where they’re visible without resizing. To view more items, people can scroll or expand the sheet.
    考虑支持中等制动器,以逐步披露工作表的内容。例如,一个共享工作表在中号制动器内显示了最相关的东西,它们不需要拉高卡片高度就可以看到。要查看更多内容,人们可以滚动或展开工作表。

    Use a nonmodal sheet when you want to present supplementary items people can use without pausing the main task. When people choose an item in a nonmodal sheet, the parent view can update in response, providing feedback on the item’s effect and letting people continue their task while the sheet remains onscreen. For example, Notes uses a nonmodal sheet to help people apply different formatting to different text selections as they edit a note. To enable a nonmodal sheet experience, you support the medium detent and remove dimming from the parent view (for developer guidance, see largestUndimmedDetentIdentifier).
    当希望在不暂停主任务的情况下展示其他补充内容时,请使用非模态工作表。当人们在非模态工作表中选择一个项目时,父视图可以响应并提供效果反馈,同时让人们在工作表仍在屏幕上的时候继续他们的任务。例如,Notes使用一个非模态工作表来帮助人们在编辑注释时对不同的文本选择应用不同的格式。
    image.png
    In general, include a grabber in a resizable sheet. A grabber shows people that they can drag the sheet to resize it; they can also tap it to cycle through the detents. In addition to providing a visual indicator of resizability, a grabber also works with VoiceOver so people can resize the sheet without seeing the screen. For developer guidance, see prefersGrabberVisible.
    一般会在可调整大小的工作表中放一个抓取器。抓取器告诉人们可以拖动工作表来调整大小; 他们也可以触摸它来循环通过制动器。除了提供可调整大小的视觉指示器,抓取器还可以响应VoiceOver盲人模式,这样人们可以在看不到屏幕的情况下调整工作表的大小。

    Don’t display a sheet on top of a popover. Although you can display a sheet within a popover, nothing should appear on top of a popover (except possibly an alert). In rare cases when you need to present a sheet after people take an action in a popover, close the popover before displaying the sheet.
    不要在指示性弹窗上方显示工作表。虽然你可以在指示性弹窗内显示工作表,但是在指示性弹窗之上不应该出现任何东西(除了可能的警告)。在极少的情况下,当人们在指示性弹窗中执行一个操作后,需要显示一个工作表时,请先关闭弹窗。