UINavigationController as child view of UIViewController
I have an application that isn't nav based. So there is no UINavigationController in the App Delegate. However, I need to switch to a UINavigationController for a piece of the application. Steps I currently took...
- Create a new Class that extends UIViewController
- Added a UINavigationController via IB
- Told IB that the new UIViewController's view is the view for the UINavigationController
The problem now is that the File's Owner needs it's view set. But via IB there is no way to specify this. So obviously, I'm not going about this 开发者_StackOverflowthe right way. Any tips in the right direction are much appreciated.
connect your navigation controller in IB (in this case navController
) and init
it with your controller:
MessageViewController *mView = [[MessageViewController alloc]initWithNibName:@"MessageView" bundle:nil];
mView.navController = [[UINavigationController alloc] initWithRootViewController:mView];
[self presentModalViewController:mView.navController animated:YES];
[mView release];
精彩评论