拆分视图控制器必须是根视图控制器 [英] Split view controller must be root view controller
问题描述
每当我尝试以模态方式呈现UISplitViewController时,应用程序崩溃。因此,它必须始终是根视图控制器。任何人都可以确认吗?
Whenever I try to present a UISplitViewController modally the application crashes. Thus it must allways be the root view controller. Can anyone confirm that?
推荐答案
来自 Apple iPad编程指南:
应始终将拆分视图控制器的视图
安装为应用程序窗口的根
视图。您
不应该在导航或标签栏
界面内显示拆分视图
。
The split view controller’s view should always be installed as the root view of your application window. You should never present a split view inside of a navigation or tab bar interface.
所以是的,你不能在主应用程序窗口之外呈现拆分视图(包括模态)。
So yes, you cannot present a split view outside of your main application window (that includes modally).
编辑
上述文档的链接不再讨论此主题。现在可以在Apple的查看控制器中找到相关讨论适用于iOS的目录,其中包含以下内容:
The link to the docs above no longer discusses this topic. Relevant discussion can now be found at Apple's View Controller Catalog for iOS, which states the following:
拆分视图控制器必须始终是您创建的任何接口的根。换句话说,您必须始终从UISplitViewController对象安装视图作为应用程序窗口的根视图。 [...]拆分视图控制器无法以模态方式显示。
A split view controller must always be the root of any interface you create. In other words, you must always install the view from a UISplitViewController object as the root view of your application’s window. [...] Split view controllers cannot be presented modally.
这篇关于拆分视图控制器必须是根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!