【问题标题】:Swift set orientation to specific screen in codeSwift 在代码中将方向设置为特定屏幕
【发布时间】:2015-06-24 16:19:54
【问题描述】:

我想以编程方式设置 ViewController 方向,并在关闭 ViewController 后我希望方向返回到以前的模式

这是我目前使用的:

if(GamePrefrences.orientation == "landscape")
    {
        value = UIInterfaceOrientation.LandscapeLeft.rawValue
    }
    else
    {
        value = UIInterfaceOrientation.Portrait.rawValue
    }

【问题讨论】:

标签: ios swift uiviewcontroller


【解决方案1】:

您可以覆盖首选InterfaceOrientationForPresentation 一个视图控制器,旨在全屏显示 具体方向。

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    • 2019-02-23
    • 2022-11-13
    • 2012-11-05
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    相关资源
    最近更新 更多