Enumeration

UIInterfaceOrientation

The orientation of the app's user interface.

Declaration

typedef enum UIInterfaceOrientation : NSInteger {
    ...
} UIInterfaceOrientation;

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 used these constants in the statusBarOrientation property and the setStatusBarOrientation:animated: method. Notice that UIDeviceOrientationLandscapeRightis assigned to UIInterfaceOrientationLandscapeLeft and UIDeviceOrientationLandscapeLeft is assigned to UIInterfaceOrientationLandscapeRight; the reason for this is that rotating the device requires rotating the content in the opposite direction.

Topics

Orientations

UIInterfaceOrientationUnknown

The orientation of the device cannot be determined.

UIInterfaceOrientationPortrait

The device is in portrait mode, with the device held upright and the home button on the bottom.

UIInterfaceOrientationPortraitUpsideDown

The device is in portrait mode but upside down, with the device held upright and the home button at the top.

UIInterfaceOrientationLandscapeLeft

The device is in landscape mode, with the device held upright and the Home button on the left side.

UIInterfaceOrientationLandscapeRight

The device is in landscape mode, with the device held upright and the Home button on the right side.

Orientation Checks

UIInterfaceOrientationIsLandscape

Returns a Boolean value indicating whether the user interface is currently presented in a landscape orientation.

UIInterfaceOrientationIsPortrait

Returns a Boolean value indicating whether the user interface is currently presented in a portrait orientation.

See Also

Managing Interface Geometry

- application:supportedInterfaceOrientationsForWindow:

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

- application:willChangeStatusBarOrientation:duration:

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

Deprecated
- application:didChangeStatusBarOrientation:

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

Deprecated
- application:willChangeStatusBarFrame:

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

Deprecated
- application:didChangeStatusBarFrame:

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

Deprecated
UIInterfaceOrientationMask

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

UIApplicationInvalidInterfaceOrientationException

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.