Pan*_*ngu 5 uitabbarcontroller uiinterfaceorientation ios swift
关于我如何限制屏幕方向,我遇到了一个奇怪的问题.
这是我的故事板的样子:
我的屏幕方向设置为仅限肖像.
在我的AppDelegate中,我有以下内容:
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
{
if self.window?.rootViewController?.presentedViewController is VideoPlayerViewController
{
return UIInterfaceOrientationMask.Landscape;
}
else
{
return UIInterfaceOrientationMask.Portrait;
}
}
Run Code Online (Sandbox Code Playgroud)
在"主页"选项卡中,单击"红色"播放按钮或任何单元格将对我执行一个segue VideoPlayerViewController.我只限制了VideoPlayerViewController景观.
但是,就在segue发生之前,会发生这种情况:
基本上,正在发生的事情是,在第二张图片中,红色部分向上移动,将状态栏推开.
然后在第3张照片中,前2个标签稍微向左移动,而最后2个标签稍微向右移动.
再次,所有这一切都发生在模态segue发生之前.
可能是什么导致了这个?如果我需要包含其他代码,请告诉我..
为了尽可能多地删除不相关的代码,以便在 github 上发布示例代码以供其他人帮助调试,我找到了问题的罪魁祸首。
它override func prefersStatusBarHidden()与我的代码有关,导致状态栏移动,现在已解决。
| 归档时间: |
|
| 查看次数: |
208 次 |
| 最近记录: |