Enumeration

UIDeviceOrientation

The physical orientation of the device.

Overview

The orientation property uses these constants to identify the device orientation. These constants identify the physical orientation of the device and are not tied to the orientation of your application’s user interface.

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 at 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.

case faceUp

The device is held parallel to the ground with the screen facing upwards.

case faceDown

The device is held parallel to the ground with the screen facing downwards.

Instance Properties

var isFlat: Bool

A Boolean value indicating whether the device is in a face-up or face-down orientation.

var isLandscape: Bool

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

var isPortrait: Bool

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

var isValidInterfaceOrientation: Bool

A Boolean value indicating whether the device orientation matches a valid interface orientation for the app.