4

Edit the device orientation.

The device orientation determines the orientation of the device: portrait, upside down, landscape left, or landscape right.

Example

4

Instructions

  1. 1
  2. 2
  3. 3

Edit ViewController.swift

  1. Open ViewController.swift
  2. Copy and paste code

Edit Hello.xcodeproj

  1. Open Hello.xcodeproj
  2. Under TARGETS, click Hello or your product name
  3. Click General tab
  4. Under Deployment Info, after Device Orientation, check Portrait, check Upside Down, check Landscape Left, check Landscape Right

Run

  1. Click Product
  2. Click Run

Code

import UIKit

class ViewController: UIViewController
{
  override func prefersStatusBarHidden() -> Bool
  {
    return true
  }
  override func supportedInterfaceOrientations() -> Int
  {
    return Int(UIInterfaceOrientationMask.All.rawValue)
  }
}