修改默认的ViewController.swift源文件。

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var webview: UIWebView!

    override var shouldAutorotate: Bool { return true }

    override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{
        return UIInterfaceOrientation.landscapeRight
    }

    override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
        return [UIInterfaceOrientationMask.landscapeRight, UIInterfaceOrientationMask.landscapeLeft]
    }
    ...
}

确认一下配置:

xcode-general.png

xcode-pinfo.png

[ 编辑 | 历史 ]
最近由“jilili”在“2017-05-13 23:12:24”修改