Created
May 5, 2014 18:30
-
-
Save iksnae/84f7a562c122b2511c6e to your computer and use it in GitHub Desktop.
UINavigationController changeViewController:animated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UINavigationController (Extras) | |
- (void)changeViewController:(UIViewController *)viewController animated:(BOOL)animated; | |
@end | |
@implementation UINavigationController (Extras) | |
- (void)changeViewController:(UIViewController *)viewController animated:(BOOL)animated | |
{ | |
if ([self.childViewControllers containsObject:viewController]) { | |
[self popToViewController:viewController animated:animated]; | |
}else{ | |
[self pushViewController:viewController animated:animated]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment