简体   繁体   中英

Navigate UIView to UINavigationViewController

I have a UIView and I need to switch to UINavigationController . This is the code I am using to navigate:

MainMenuNavigationViewController * aMainMenuNavigationViewController = [[MainMenuNavigationViewController alloc] initWithNibName:@"MainMenuNavigationViewController" bundle:nil];
[self presentModalViewController:aMainMenuNavigationViewController animated:YES];

I am getting an error

-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MainMenuNavigationViewController" nib but the view outlet was not set.'

I wasted around 12 hours searching the internet. However I could not find the solution.

In your MainMenuNavigationViewController.xib open in Interface builder, In document window right click on view referencing outlet was not set, so right click and select files owner view. That was the issue there. Now code that you shared isn't loading viewController using navigation Controller you are presenting MainMenuNavigationViewController modally presentModalViewController.

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