whose view is not in the window hierarchy
视图层级混乱造成的 打开控制器的方式present 与push 都不行,可以执行下面的方法
- (UIViewController *)goBackForViewController{
UIViewController *topRootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topRootViewController.presentedViewController)
{
topRootViewController = topRootViewController.presentedViewController;
}
return topRootViewController;
}
调用 [[self goBackForViewController] presentViewController:新创建的控制器(或者push)];
[topRootViewController presentViewController:nav animated:NO completion:nil];
让天下没有难写的代码