//添加代理<UIGestureRecognizerDelegate> 实现代理方法 全部都放在 导航根视图里面 @interface SCNavigationController () <UIGestureRecognizerDelegate> @end @implementation NavigationController - (void)viewDidLoad { [super viewDidLoad]; //返回手势 self.interactivePopGestureRecognizer.delegate = self; } #pragma mark - 返回手势 - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { if (self.navigationController.viewControllers.count == 1) {//关闭主界面的右滑返回 return NO; } else { return YES; } }