Enumeration

UIInterfaceOrientation

The orientation of the app's user interface.

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

Constants

case unknown

The orientation of the device cannot be determined.

case portrait

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

case portraitUpsideDown

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

case landscapeLeft

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

case landscapeRight

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

Instance Properties

var isLandscape: Bool

A Boolean value indicating whether the interface is in the landscape-left or landscape-right orientation.

var isPortrait: Bool

A Boolean value indicating whether the interface is in a portrait or portrait upside-down orientation.