I’d like my view controller to have its own navigation bar. I find this is easier than showing/hiding the existing navigation bar. The following code is working. Is this an anti-pattern or is it relatively common practice?
MyViewController *viewController = [[MyViewController alloc] init]
autorelease];
UINavigationController *wrapper = [[[UINavigationController alloc]
initWithRootViewController:viewController]
autorelease];
[self.navigationController presentViewController:wrapper
animated:YES
completion:nil];
To present a modal view controller with a nav bar and its own navigation stack, the code you posted is exactly right. The only thing you should be careful of is pushing a second UINavigationController onto an existing nav controller’s stack — that will cause you problems.