Disable the interactive dismissal of presented view controller

前端 未结 5 980
星月不相逢
星月不相逢 2020-12-07 08:48

iOS 13 introduces a new design of modalPresentationStyle .pageSheet (and its sibling .formSheet) for modally presente

5条回答
  •  暖寄归人
    2020-12-07 09:14

    The property isModalInPresentation might help.

    From the documentation:

    When you set it to true, UIKit ignores events outside the view controller's bounds and prevents the interactive dismissal of the view controller while it is onscreen.

    You can use it like this:

    let controller = MyViewController()
    controller.isModalInPresentation = true
    self.present(controller, animated: true, completion: nil)
    

提交回复
热议问题