InteractivePopGestureRecognizer causing app freezing

前端 未结 9 1802
再見小時候
再見小時候 2021-01-31 10:29

In my app I have different controllers. When I push controller1 to navigation controller and swipe to back, all works good. But, if I push navigation controller1, and into contr

9条回答
  •  长发绾君心
    2021-01-31 10:50

    My solution was to add a delegate to the navigation controller. Then disable the pop gesture recogniser in the root view controller only. YMMV.

    #pragma mark - UINavigationControllerDelegate
    
    - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        BOOL isRootVC = viewController == navigationController.viewControllers.firstObject;
        navigationController.interactivePopGestureRecognizer.enabled = !isRootVC;
    }
    

提交回复
热议问题