ios - SWRevealViewController 中的推送 View 错误

标签 ios objective-c uinavigationcontroller swrevealviewcontroller

我在 Root View 中使用 SWRevealViewController 并在自定义类中使用两个按钮制作自定义静态 View 。
如果我单击按钮 - 从自定义类推送 nextView Controller

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

UINavigationController *navigationController = [storyBoard instantiateViewControllerWithIdentifier:@"historyGoodsView"];

SWRevealViewController *rootViewController = (SWRevealViewController *)[[[UIApplication sharedApplication] keyWindow]rootViewController];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];

[navController pushViewController:navigationController animated:true];

但是在推送之后看到的错误如下:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'adding a root view controller SWRevealViewController: 0x137629e60 as a child of view controller:UINavigationController: 0x137658b50' *** First throw call stack: (0x1844bc2d8 0x195ce00e4 0x1844bc218 0x188f976c0 0x188f975b0 0x188f8cb00 0x188f8c700 0x188fea070 0x1000e39d8 0x188f31404 0x188f1a4e0 0x188f30da0 0x188f30a2c 0x188f29f68 0x188efd18c 0x18919e324 0x188efb6a0 0x184474240 0x1844734e4 0x184471594 0x18439d2d4 0x18dbb36fc 0x188f62fac 0x100108218 0x19635ea08) libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

你犯的错误是 nested UINavigationController 因为它建议在嵌套时不要使用多个 UINavigationController

所以只需使用您的 UIViewController 而不是在 UINavigationcontroller 上使用 UINavigationcontroller

关于ios - SWRevealViewController 中的推送 View 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29742167/

相关文章:

ios - 当应用商店中有我的应用更新时,我的应用的设备 token 会更改吗?

没有错误或堆栈跟踪的 iOS 崩溃

ios - 在 iOS 中使用 db 的 SQLite 软件

ios - 在退出调用方法之前显示不会更新

ios - 导入 mymodel.mlmodel 时出现 CoreML : source file is not valid , 错误

ios - MonoTouch 中的自定义 UINavigationBar

swift - UIImagePickerController 未正确关闭

ios - 在 UINavigationController 中控制向后滑动操作

ios - 将 View Controller 推送到选项卡 Controller 中的 View 控件

ios - 我不断收到有关我的 iOS 项目的 .png 文件的多个构建命令的警告