【发布时间】:2016-03-21 01:36:56
【问题描述】:
关于如何限制屏幕方向,我遇到了一个奇怪的问题。
这是我的故事板的样子:
我将屏幕方向设置为仅纵向。
在我的 AppDelegate 中,我有以下内容:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
{
if self.window?.rootViewController?.presentedViewController is VideoPlayerViewController
{
return UIInterfaceOrientationMask.Landscape;
}
else
{
return UIInterfaceOrientationMask.Portrait;
}
}
在“主页”选项卡中,单击红色播放按钮或任何单元格都会转到我的 VideoPlayerViewController。我已将 VideoPlayerViewController 限制为仅限横向。
然而,就在转场发生之前,这发生了:
基本上,发生的事情是在第二张图片中,红色部分向上移动,将状态栏推开。
然后在第三张图片中,前 2 个选项卡略微向 left 移动,而最后 2 个选项卡向 向右 略微移动。
再一次,所有这些都发生在 Modal segue 发生之前。
这可能是什么原因造成的?如果我需要包含其他代码,请告诉我。
【问题讨论】:
-
您能告诉我们您在故事板中设置的约束吗?
-
有很多限制。我可以在 github 上发布一个示例代码,以便您查看并帮助调试问题?
标签: ios swift uitabbarcontroller uiinterfaceorientation