UISheetPresentationController

4176 ワード

https://developer.apple.com/documentation/uikit/uisheetpresentationcontroller
"A presentation controller that manages the appearance and behavior of a sheet."

図面の外観と動作を管理するためのプレゼンテーションコントロール.

Declaration

@MainActor class UISheetPresentationController : UIPresentationController

Overview

UISheetPresentationControllerは、ビューコントローラを図面形式で表示することを可能にする.ビューコントローラを表示する前に、ページに必要な動作と外観があることを確認し、ビューコントローラのsheetPresentationControllerプロパティにページプレゼンテーションコントローラを設定します.
// In a subclass of UIViewController, customize and present the sheet.
func showMyViewControllerInACustomizedSheet() {
    let viewControllerToPresent = MyViewController()
    if let sheet = viewControllerToPresent.sheetPresentationController {
        sheet.detents = [.medium(), .large()]
        sheet.largestUndimmedDetentIdentifier = .medium
        sheet.prefersScrollingExpandsWhenScrolledToEdge = false
        sheet.prefersEdgeAttachedInCompactHeight = true
        sheet.widthFollowsPreferredContentSizeWhenEdgeAttached = true
    }
    present(viewControllerToPresent, animated: true, completion: nil)
}
「図面表示」コントローラは、図面の高さdetentに基づいて図面寸法を最適化し、図面を自然に保つ.detentでは、ページに3つの異なる枠線を固定するときに、展開フレーム全体の枠線からサイズを変更できます.detentは、図面使用をサポートするために具体化され、最近選択されたdetentは、selectedDetentIdentifierを使用して監視される.
Related Sessions from WWDC21 Session 10063: Customize and Resize Sheets in UIKit

Customize and Resize Sheets in UIKit
https://developer.apple.com/videos/play/wwdc2021/10063/

See Also


Presentation Management


UIPresentationController