LoginSignup
1
5

More than 5 years have passed since last update.

Swiftで画面の向きを固定する方法

Last updated at Posted at 2017-03-29

iosアプリで画面の向きを固定する方法

アプリの画面を横向きで固定したいのに最新のコードが(貼り付けて動くもの)がなかったので。

swift3(2017.3.28現在)
画面の向きを指定する方法は(横向き)
以下だ。

とりあえず

Viewcontroller.swift

    override var shouldAutorotate: Bool {
        return true
    }

    override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return UIInterfaceOrientationMask.landscape
    }

追記 2019.04.01

プロジェクト全体で画面の向きを固定する

xcodeの設定画面でぽちぽちすれば良い。

特定のViewControllerで画面の向きを固定する

iPadで画面が回転してしまう

1
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
5