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.

Testing the Orientation

var isFlat: Bool

A Boolean value indicating whether the specified orientation is face up or face down.

Beta
var isLandscape: Bool

Returns a Boolean value indicating whether the device is in a landscape orientation.

var isPortrait: Bool

Returns a Boolean value indicating whether the device is in a portrait orientation.

var isValidInterfaceOrientation: Bool

A Boolean value indicating whether the specified orientation is one of the portrait or landscape orientations.

See Also

Tracking the Device Orientation

var orientation: UIDeviceOrientation

Returns the physical orientation of the device.

var isGeneratingDeviceOrientationNotifications: Bool

A Boolean value that indicates whether the receiver generates orientation notifications (true) or not (false).

func beginGeneratingDeviceOrientationNotifications()

Begins the generation of notifications of device orientation changes.

func endGeneratingDeviceOrientationNotifications()

Ends the generation of notifications of device orientation changes.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software