Skip to content

Instantly share code, notes, and snippets.

@bjhomer
Created November 2, 2012 22:49
Show Gist options
  • Save bjhomer/4004837 to your computer and use it in GitHub Desktop.
Save bjhomer/4004837 to your computer and use it in GitHub Desktop.
Convenience method for presenting a modal view controller inside a navigation controller
@implementation UIViewController (NavigationPresentation_additions)
- (void)presentViewController:(UIViewController *)viewControllerToPresent inNavigationControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewControllerToPresent];
[self presentViewController:navController animated:flag completion:completion];
}
@end
///////////////////////////////////
@interface ModalNavigationSegue
@end
@implementation ModalNavigationSegue
- (void)perform {
[self.sourceViewController presentViewController:self.destinationViewController
inNavigationControllerAnimated:YES
completion:NULL];
}
@end
@3lvis
Copy link

3lvis commented Nov 3, 2012

Wow, so hard.

presentNavigationControllerWithViewController:animated:completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment