Structure

UIInterfaceOrientationMask

These constants are mask bits for specifying a view controller’s supported interface orientations.

Overview

Starting in iOS 8, you should employ the UITraitCollection and UITraitEnvironment APIs, and size class properties as used in those APIs, instead of using UIInterfaceOrientation constants or otherwise writing your app in terms of interface orientation.

In earlier versions of iOS, you returned these constants from the supportedInterfaceOrientations(for:) method or when determining which orientations to support in your app’s view controllers.

Topics

Constants

static var portrait: UIInterfaceOrientationMask

The view controller supports a portrait interface orientation.

static var landscapeLeft: UIInterfaceOrientationMask

The view controller supports a landscape-left interface orientation.

static var landscapeRight: UIInterfaceOrientationMask

The view controller supports a landscape-right interface orientation.

static var portraitUpsideDown: UIInterfaceOrientationMask

The view controller supports an upside-down portrait interface orientation.

static var landscape: UIInterfaceOrientationMask

The view controller supports both landscape-left and landscape-right interface orientation.

static var all: UIInterfaceOrientationMask

The view controller supports all interface orientations.

static var allButUpsideDown: UIInterfaceOrientationMask

The view controller supports all but the upside-down portrait interface orientation.

Relationships

Conforms To

See Also

Managing Interface Geometry

func application(UIApplication, supportedInterfaceOrientationsFor: UIWindow?) -> UIInterfaceOrientationMask

Asks the delegate for the interface orientations to use for the view controllers in the specified window.

func application(UIApplication, willChangeStatusBarOrientation: UIInterfaceOrientation, duration: TimeInterval)

Tells the delegate when the interface orientation of the status bar is about to change.

func application(UIApplication, didChangeStatusBarOrientation: UIInterfaceOrientation)

Tells the delegate when the interface orientation of the status bar has changed.

func application(UIApplication, willChangeStatusBarFrame: CGRect)

Tells the delegate when the frame of the status bar is about to change.

func application(UIApplication, didChangeStatusBarFrame: CGRect)

Tells the delegate when the frame of the status bar has changed.

enum UIInterfaceOrientation

The orientation of the app's user interface.

class let invalidInterfaceOrientationException: NSExceptionName

This exception is thrown if a view controller or the app returns 0 instead of a valid set of supported interface orientation values. It is also thrown if the orientation returned by a view controller’s preferredInterfaceOrientationForPresentation method does not match one of the view controller’s supported orientations.