#import
@interfaceBaseNavigationController :UINavigationController
@property(nonatomic,weak)UIViewController* currentShowVC;
@end
@implementation BaseNavigationController
-(id)initWithRootViewController:(UIViewController*)rootViewController
{
BaseNavigationController* nvc = [superinitWithRootViewController:rootViewController];
self.interactivePopGestureRecognizer.delegate=self;
nvc.delegate=self;
returnnvc;
}
-(void)navigationController:(UINavigationController*)navigationController willShowViewController:(UIViewController*)viewController animated:(BOOL)animated
{
}
-(void)navigationController:(UINavigationController*)navigationController didShowViewController:(UIViewController*)viewController animated:(BOOL)animated
{
if(navigationController.viewControllers.count==1)
self.currentShowVC=Nil;
else
self.currentShowVC= viewController;
}
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer
{
if(gestureRecognizer ==self.interactivePopGestureRecognizer) {
return(self.currentShowVC==self.topViewController);
}
returnYES;
}
网友评论