iOS 16:为表单呈现控制器设置最小制动

dtcbnfnu  于 2022-12-27  发布在  iOS
关注(0)|答案(1)|浏览(74)

iOS 16扩展的UISheetPresentationController API中是否有方法为显示的表单设置最小制动高度?(即,使其不会从屏幕上消失?)
演示代码示例:

let viewControllerToPresent = UIViewController()
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)
bq3bfh9z

bq3bfh9z1#

添加viewControllerToPresent.isModalInPresentation = true作为属性可以实现这种体验。

相关问题