Instance Property

orientation

Returns the physical orientation of the device.

Declaration

var orientation: UIDeviceOrientation { get }

Discussion

The value of the property is a constant that indicates the current orientation of the device. This value represents the physical orientation of the device and may be different from the current orientation of your application’s user interface. See UIDeviceOrientation for descriptions of the possible values.

The value of this property always returns 0 unless orientation notifications have been enabled by calling beginGeneratingDeviceOrientationNotifications().

See Also

Getting the Device Orientation

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.