简体   繁体   English

将UIView导航到UINavigationViewController

[英]Navigate UIView to UINavigationViewController

I have a UIView and I need to switch to UINavigationController . 我有一个UIView ,我需要切换到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.' -[UIViewController _loadViewFromNibNamed:bundle:]加载了“ MainMenuNavigationViewController”笔尖,但未设置视图出口。

I wasted around 12 hours searching the internet. 我浪费了大约12个小时来搜索互联网。 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. 在“界面”构建器中打开的MainMenuNavigationViewController.xib中,在文档窗口中右键单击未设置引用出口的视图,因此右键单击并选择文件所有者视图。 That was the issue there. 那就是那里的问题。 Now code that you shared isn't loading viewController using navigation Controller you are presenting MainMenuNavigationViewController modally presentModalViewController. 现在,您共享的代码不会使用导航控制器加载viewController,而是以模态形式呈现mainMenuNavigationViewController presentModalViewController。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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