我在 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/