Instance Property

supportedInterfaceOrientations

The interface orientations that the view controller supports.

Declaration

@property(nonatomic, readonly) UIInterfaceOrientationMask supportedInterfaceOrientations;

Return Value

A bit mask specifying the supported orientations. See UIInterfaceOrientationMask for valid bit-mask values. The value that returns from 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 rotate accordingly. The system only calls this method if the view controller'€™s shouldAutorotate method returns YES.

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 are UIInterfaceOrientationMaskAll for the iPad idiom and UIInterfaceOrientationMaskAllButUpsideDown for the iPhone idiom.

To determine whether to rotate, the system compares 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:supportedInterfaceOrientationsForWindow: method) and the device's supported orientations. For example, the UIViewController class doesn’t support UIInterfaceOrientationPortraitUpsideDown orientation on devices without a Home button, such as iPhone X.

If your app supports multitasking, the system doesn’t call this method on your view controller because multitasking apps must support all orientations. You can opt out of multitasking by enabling Requires full screen on your iOS target or by not declaring support for all possible orientations within the Info.plist file.

See Also

Configuring the View Rotation Settings

shouldAutorotate

A Boolean value that indicates whether the view controller'€™s contents should autorotate.

preferredInterfaceOrientationForPresentation

The interface orientation to use when presenting the view controller.

+ attemptRotationToDeviceOrientation

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