iPad:SplitView不会旋转 [英] iPad: SplitView does not rotate
问题描述
我有以下设置:
- 创建的
UISplitViewController
的子类构造函数中的主视图和详细视图控制器。 - 主视图和详细视图控制器都覆盖
shouldAutorotateToInterfaceOrientation
返回YES
。 - 详情视图控制器实现
UISplitViewControllerDelegate
协议并处理popover。
- A subclass of
UISplitViewController
that creates the master and detail view controllers in the constructor. - Master and Detail view controllers that both override
shouldAutorotateToInterfaceOrientation
to returnYES
. - Detail view controller implements the
UISplitViewControllerDelegate
protocol and deals with the popover.
我观察到两个可能相互关联的奇怪问题:
I am observing two weird issues that might be interrelated:
-
当分割视图出现时(纵向模式 - 模拟器上的默认设置),主视图可见。它不应该是。
When the split view comes up (in portrait mode - default on simulator), the Master view is visible. It should not be.
当我旋转模拟器时,视图本身并不正确。
When I rotate the simulator, the view does not "right" itself.
我的 UISplitViewController
子类不会覆盖 shouldAutorotateToInterfaceOrientation
。但是,主视图和详细信息视图控制器都会返回 YES
。
My UISplitViewController
subclass does not override shouldAutorotateToInterfaceOrientation
. However, both master and details view controllers do and return YES
.
任何想法我可能做错了什么?这是一个模拟器错误吗?
Any ideas what I might be doing wrong? Is this a simulator bug?
推荐答案
对于其他任何人来到这里:这是因为我的拆分视图控制器的视图不是根。这是绝对必要的。
For anyone else who lands here: This was happening because my split view controller's view was not the root. This is absolutely required.
这篇关于iPad:SplitView不会旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!