Instance Property

supportedInterfaceOrientations

Returns all of the interface orientations that the view controller supports.

Declaration

var supportedInterfaceOrientations: UIInterfaceOrientationMask { get }

Return Value

A bit mask specifying which orientations are supported. See UIInterfaceOrientationMask for valid bit-mask values. The value returned by this method must not be 0.

Discussion

When the user changes the device orientation, the system calls this method on the root view controller or the topmost presented view controller that fills the window. If the view controller supports the new orientation, the window and view controller are rotated to the new orientation. This method is only called if the view controller'€™s shouldAutorotate method returns true.

Override this method to report all of the orientations that the view controller supports. The default values for a view controller'€™s supported interface orientations is set to all for the iPad idiom and allButUpsideDown for the iPhone idiom.

The system intersects the view controller'€™s supported orientations with the app's supported orientations (as determined by the Info.plist file or the app delegate's application(_:supportedInterfaceOrientationsFor:) method) and the device's supported orientations to determine whether to rotate. For example, the portraitUpsideDown orientation is not supported on iPhone X.

See Also

Configuring the View Rotation Settings

var shouldAutorotate: Bool

Returns a Boolean value indicating whether the view controller'€™s contents should auto rotate.

var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation

Returns the interface orientation to use when presenting the view controller.

class func attemptRotationToDeviceOrientation()

Attempts to rotate all windows to the orientation of the device.