You can always create a simple subclass of UINavigationController and wrap its superclass methods so that you set a flag before calling them:
ActionNavigationController.h
ActionNavigationController.m
#import "ActionNavigationController.h" @implementation ActionNavigationController @synthesize pushing = _pushing; -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { _pushing = YES; [super pushViewController:viewController animated:animated]; } - (UIViewController *)popViewControllerAnimated:(BOOL)animated { _pushing = NO; return [super popViewControllerAnimated:animated]; } - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated { _pushing = NO; return [super popToViewController:viewController animated:animated]; } - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated { _pushing = NO; return [super popToRootViewControllerAnimated:animated]; } @end
Since pushing
will evaluate the NO
event if nothing happens, this code is expected to be available from the UINavigationControllerDelegate.
Mike m
source share