- 出現(xiàn)三個小藍點
- 在navigationViewController 的rootViewController中使用側滑手勢后菩颖,push,出現(xiàn)卡頓現(xiàn)象。按下home鍵披泪,在進入就會跳轉到push的界面蜗侈。
class BaseNavigationVC: UINavigationController,UINavigationControllerDelegate{
var popGestureDelegate: UIGestureRecognizerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
self.popGestureDelegate = self.interactivePopGestureRecognizer?.delegate
self.delegate = self
}
//MARK: - push事件攔截
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
// 去除手勢藍點
viewController.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .done, target: nil, action: nil)
if childViewControllers.count > 0 {
viewController.hidesBottomBarWhenPushed = true
}
super.pushViewController(viewController, animated: animated)
}
//MARK: - 導航欄試圖完全顯示
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
if viewController == self.viewControllers[0] { //rootVC禁止側滑
self.interactivePopGestureRecognizer!.delegate = self.popGestureDelegate
}
else { //清空滑動返回手勢的代理就能實現(xiàn)滑動返回功能
self.interactivePopGestureRecognizer!.delegate = nil
}
}
}
最后編輯于 :
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者