viewController.isModalInPresentation = true
(Disabled interactive 100 dismissal acts like this.)
UIViewController
包含一个名为isModalInPresentation
的新属性,必须将其设置为true
以防止交互式解雇. .popover
等演示样式,请记住这一点. false
.From the 100:如果为
true
,则UIKit忽略视图控制器边界之外的事件,并防止在视图控制器显示在屏幕上时以交互方式取消该视图控制器.
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
return false
}
UIAdaptivePresentationControllerDelegate
包含一种称为presentationControllerShouldDismiss
的新方法.isModalInPresentation
属性设置为false
时,才调用此方法.Tip:不要忘记分配Presentation Controller的代理.