Swift3.0手势侧滑BUG

  • 出现三个小蓝点
  • 在navigationViewController 的rootViewController中使用侧滑手势后,push,出现卡顿现象。按下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 {    //清空滑动返回手势的代理就能实现滑动返回功能
            self.interactivePopGestureRecognizer!.delegate = nil
        }
    }

    
}

你可能感兴趣的:(Swift3.0手势侧滑BUG)