修复Navigatoin测滑返回
2020-09-08 本文已影响0人
久百一
class xxxxxViewController: UIViewController {
// 修复侧滑丢失
private var naDelegate: UIGestureRecognizerDelegate?
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// 修复侧滑丢失
naDelegate = navigationController?.interactivePopGestureRecognizer?.delegate
navigationController?.interactivePopGestureRecognizer?.delegate = self as? UIGestureRecognizerDelegate
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// 修复侧滑丢失
navigationController?.interactivePopGestureRecognizer?.delegate = naDelegate
}