我目前将UIViewController添加到我的视图中。 现在,用户可以通过拖动到屏幕底部来删除该视图。如何禁用它?
我尝试
view.isUserInteractionEnabled = false
和
override func viewDidLoad() {
self.transitioningDelegate = self
}
extension MyViewController: UIViewControllerTransitioningDelegate {
func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
return nil
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}
}
但是用户仍然可以关闭它。