[英]How disable drag dismiss in UIViewController
I have UIViewController add to my view by present. 我现在有UIViewController添加到我的视图。 Now user can remove this view by drag to bottom of screen.
现在,用户可以通过拖动到屏幕底部来删除该视图。 How can I disable it?
如何禁用它?
I try by 我尝试
view.isUserInteractionEnabled = false
and 和
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
}
}
But user still can dismiss it. 但是用户仍然可以将其关闭。
您需要禁用平移手势才能禁用拖动关闭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.