Add UINavigationController to preview on iPhone

I am trying to add this UINavigationController to the subtitle of my form ... All I get is a large gray screen.

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

It should add a fullscreen navigation controller to the current view.

+3
source share
2 answers

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

Basically, you also need to set the view for navigationController ...

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

You may need to call makeKeyAndVisible.

0
source

Source: https://habr.com/ru/post/1751665/


All Articles