在我的应用中,我使用了导航 Controller 。稍后在某些 View 中,我使用 presentViewController
来显示缩放图像。
我也没有使用 Storyboard 或 Nib 。
我仅在 iOS 7 中遇到此错误。它在 iOS 6 及更早版本中运行良好:
Presenting view controllers on detached view controllers is discouraged
最佳答案
为避免在推送导航中收到警告,您可以直接使用:
[self.view.window.rootViewController presentViewController:viewController animated:YES completion:nil];
然后在你的模态视图 Controller 中,当一切都完成后,你可以调用:
[self dismissViewControllerAnimated:YES completion:nil];
关于ios - 警告 :-Presenting view controllers on detached view controllers is discouraged,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19890761/