当我需要从视图控制器显示导航控制器时出现错误,如下所示:
“警告:尝试呈现不在窗口层次结构中的视图!”
代码如下:
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"NavMain" bundle:nil];
UINavigationController * mainViewController = [storyboard instantiateInitialViewController];
mainViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:mainViewController animated:YES completion:NO];
如何修复错误或在实现情节提要时出现任何错误?我使用两个故事板从main.storyboard
到NavMain.storyboard