开发者

UINavigationController as child view of UIViewController

开发者 https://www.devze.com 2023-02-01 17:02 出处:网络
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 curre

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消