iOS 侧滑手势导致的页面假死问题

今天测试提了个bug,说是我的页面偶现点击push的时候页面卡死

经过定位,发现这实际上是根控制器与侧滑手势interactivePopGestureRecognizer的冲突导致的问题。
当页面在根控制器内的时候需要禁用掉侧滑手势

我们是自定义的导航控制器,在自定义的导航控制器里面添加对应的导航代理方法

 - (void)viewDidLoad {
    [super viewDidLoad];
    self.interactivePopGestureRecognizer.delegate = self;
}

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (navigationController.viewControllers.count > 1) {
        self.interactivePopGestureRecognizer.enabled = YES;
    } else {
        self.interactivePopGestureRecognizer.enabled = NO;
    }
}

你可能感兴趣的:(iOS 侧滑手势导致的页面假死问题)