@interfaceBaseNavigationController : UINavigationController<UINavigationControllerDelegate,UIGestureRecognizerDelegate>@end@implementationBaseNavigationController-(void)viewDidLoad{__weakBaseNavigationController*weakSelf=self;if([selfrespondsToSelector:@selector(interactivePopGestureRecognizer)]){self.interactivePopGestureRecognizer.delegate=weakSelf;self.delegate=weakSelf;}}// Hijack the push method to disable the gesture-(void)pushViewController:(UIViewController*)viewControlleranimated:(BOOL)animated{if([selfrespondsToSelector:@selector(interactivePopGestureRecognizer)])self.interactivePopGestureRecognizer.enabled=NO;[superpushViewController:viewControlleranimated:animated];}#pragma mark UINavigationControllerDelegate-(void)navigationController:(UINavigationController*)navigationControllerdidShowViewController:(UIViewController*)viewControlleranimated:(BOOL)animate{// Enable the gesture again once the new controller is shownif([selfrespondsToSelector:@selector(interactivePopGestureRecognizer)])self.interactivePopGestureRecognizer.enabled=YES;}@end