UISplitViewController和复杂的视图层次结构 [英] UISplitViewController and complex view hierarchy

查看:118
本文介绍了UISplitViewController和复杂的视图层次结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个iPad技术演示,我遇到了严重的技术问题。

I'm doing an iPad tech demo and I'm running into a serious technical problem.

我有一个利用UISplitViewController的应用程序概念,但不是整个应用程序的主要控制器。

I have an app concept that leverages UISplitViewController, but NOT as the primary controller for the entire app.

应用程序流程大致可以这样描述:

The app flow could be described roughly as this:

主屏幕( UIViewController)
List-> DetailCatalog(UISplitViewController)
超级细节屏幕(UIViewController但可以想象也是SplitView的孩子)。

Home screen (UIViewController) List->Detail "Catalog" (UISplitViewController) Super Detail Screen (UIViewController but could conceivable also be a child of SplitView).

问题在于Home和Catalog之间的流程。一旦将UISplitViewController视图添加到UIWindow,它就会开始出现混乱。

The problem is in the flow between Home and Catalog. Once a UISplitViewController view is added to the UIWindow, it starts to throw hissy fits.

问题可归纳为:

当UISplitView生成弹出视图时,它似乎会被锁存到其父视图。从UIWindow子视图中删除UISplitView后,您将获得CoreGraphics异常,并且视图将无法删除。

When a UISplitView generates a popover view, it appears to then be latched to its parent view. Upon removing the UISplitView from the UIWindow subviews, you will get a CoreGraphics exception and the view will fail to be removed.

添加其他视图时(可能在这种情况下,你要返回的主屏幕,它们不会自动旋转,相反,由于CG异常而无法移除的UISplitView继续响应旋转,导致可怕的渲染错误,不能只是处理。此时,添加任何视图,甚至重新添加SplitView,都会导致一连串的渲染错误。

When adding other views (presumably in this case, the home screen to which you are returning), they do not autorotate, instead, the UISplitView, which has failed to be removed due to a CG exception, continues to respond to the rotation instead, causing horrible rendering bugs that can't be just "dealt with". At this point, adding any views, even re-adding the SplitView, causes a cascade of render bugs.

然后我试着让SplitView永远存在为底部查看,并保持在其顶部添加和删除主屏幕,但这失败,因为SplitView支配Orientation更改调用,并且主屏幕不会旋转,即使您调用[homeScreen becomeFirstResponder]

I then tried simply to leave the SplitView ever present as the "bottom" view, and keeping adding and removing the Home Screen from on top of it, but this fails as SplitView dominates the Orientation change calls, and Home Screen will not rotate, even if you call [homeScreen becomeFirstResponder]

你不能将SplitView放入像UINavigationController这样的层次结构中,你会得到一个彻头彻尾的运行时错误,因此该选项不在桌面上。模态看起来很糟糕,无论如何都不鼓励。

You can't put SplitView into a hierarchy like UINavigationController, you will get an outright runtime error, so that option is off the table. Modals just look bad and are discourages anyway.

我此时的推测是,处理这个问题的唯一正确方法是以某种方式解除UISplitViewController以便它可以从其父视图中删除而不抛出未处理的异常,但我不知道如何。

My presumption at this moment is that the only proper way to deal with this problem is so somehow "disarm" UISplitViewController so that it can be removed from its parent view without throwing an unhandled exception, but I have no idea how.

如果你想看到一个完全符合我需要的应用程序,在iPad应用程序商店中查看GILT Groupe。他们把它拉了下来,但他们似乎编写了一个完整的自定义视图转换集。

If you want to see an app that does exactly what I need to do, check out GILT Groupe in the iPad app store. They pulled it off, but they seem to have programmed an entire custom view transition set.

非常感谢帮助。

推荐答案

我已经为自己解决了这个问题......实际上已经解决了......将所有其他可能的全屏视图呈现为SplitView的模态......

I've solved this for myself... actually worked around... by presenting all other possible full screen views as modals of the SplitView...

在我的书中,这是一种令人厌恶的做事方式,但如果您只想在应用程序中有时使用SplitView,Apple别无选择。

This is an unsavory way of doing things in my book, but Apple leaves you little choice if you want to leverage a SplitView only "sometimes" within an app.

这篇关于UISplitViewController和复杂的视图层次结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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