带有NavigationControllers的UISplitViewController(包括示例代码) [英] UISplitViewController with NavigationControllers (including sample code)

查看:160
本文介绍了带有NavigationControllers的UISplitViewController(包括示例代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



http://drop.io/stackproblem



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



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



MultipleDetailViews [8531:207 ] 由于未捕获异常NSInvalidArgumentException而终止应用程序,原因:无法从没有窗口的视图显示Popovers。 p>如果您使用PORTRAIT中的应用程序,并从第一个控制器导航(仍然是纵向),第二个,第一个,第二个,然后使用popover控制器进行boom CRASH,则会出现此错误。 p>

停止宕机的一种方法是停止延迟加载导航控制器,并每次都加载新的,但这不是我做的应用程序的选项。

解决方案

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


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.

解决方案

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

这篇关于带有NavigationControllers的UISplitViewController(包括示例代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆