Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

Organization

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

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で画面が回転してしまう

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
5
Help us understand the problem. What are the problem?