简体   繁体   中英

Add UINavigationController to subview on iPhone

I have been trying to add this UINavigationController to a subview of my form... All I am getting is a large grey screen.

LiteViewController *lite = [[LiteViewController alloc] initWithNibName:@"LiteViewController" bundle:nil];
[self.view addSubview:lite.navigationController.view];

It should add a full screen navigation controller to the current view.

I found a post, UINavigationController not showing the Root View controller , that worked for me.

Basically you also need to set the view of the navigationController...

[self.view addSubview:navigationController.view];
[navigationController setView:[[navigationController.viewControllers objectAtIndex:0] view]];

您可能需要makeKeyAndVisible调用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM