UISplitViewController 与 NavigationControllers(包括示例代码)

发布于 2024-09-26 12:38:01 字数 494 浏览 0 评论 0原文

查看此问题的最简单方法是在此处运行示例项目:

http://drop.io/stackproblem

基本上,它是一个 uisplitviewcontroller,可以在 2 个详细视图之间切换,这两个视图都是导航控制器。

问题是它崩溃并出现以下错误:

MultipleDetailViews[8531:207] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“无法从没有窗户。'

如果您在纵向中使用该应用程序,并且从第一个控制器导航(仍然是纵向)到第二个控制器,到第一个控制器,再到第二个控制器,然后使用弹出控制器崩溃,它会因此错误而崩溃。

阻止崩溃的一种方法是停止延迟加载导航控制器并每次都重新加载它们,但这不是我正在制作的应用程序的选项。

任何想法都可能和我坠入爱河。

The easiest way to see this problem will be to run the sample project here:

http://drop.io/stackproblem

Basically, It's a uisplitviewcontroller which can be switched between 2 detail views, both of which are navigation controllers.

The problem is that it crashes with the following error:

MultipleDetailViews[8531:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a view which does not have a window.'

It crashes with this error if you use the app in PORTRAIT and you navigate (still in portrait) from the first controller, to the second, to the first, to the second, and then boom CRASH using the popover controller.

One way to stop the crash is to stop lazy loading the navigation controllers and to load them fresh everytime but this isn't an option for the app I'm making.

Any ideas and I may fall in love.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷默言语 2024-10-03 12:38:01

尝试在导致崩溃的行之前使用 if (self.view.window != nil) 。

Try using if (self.view.window != nil) just before the line that's causing the crash.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文