4
Edit the device orientation.
The device orientation determines the orientation of the device: portrait, upside down, landscape left, or landscape right.
Example
Instructions
Edit ViewController.swift
- Open ViewController.swift
- Copy and paste code
Edit Hello.xcodeproj
- Open Hello.xcodeproj
- Under TARGETS, click Hello or your product name
- Click General tab
- Under Deployment Info, after Device Orientation, check Portrait, check Upside Down, check Landscape Left, check Landscape Right
Run
- Click Product
- Click Run
Code
import UIKit class ViewController: UIViewController { override func prefersStatusBarHidden() -> Bool { return true } override func supportedInterfaceOrientations() -> Int { return Int(UIInterfaceOrientationMask.All.rawValue) } }