Returns the default set of interface orientations to use for the view controllers in the specified window.
The window whose default interface orientations you want to retrieve.
A bit mask specifying which orientations are supported. See
“UIInterfaceOrientationMask” for valid bit-mask values. The value returned by this method must not be
This method returns the default interface orientations for the app. These orientations are used only for view controllers that do not specify their own. If your app delegate implements the
application:supportedInterfaceOrientationsForWindow:method, the system does not call this method.
The default implementation of this method returns the app’s default set of supported interface orientations, as defined in the
UISupportedInterfaceOrientations key of the
Info.plist file. If the file does not contain that key, this method returns all interface orientations for the iPad idiom and returns all interface orientations except the portrait upside-down orientation for the iPhone idiom.
- Available in iOS 6.0 and later.
Autorotation is changing in iOS 6. In iOS 6, the
UIViewControlleris deprecated. In its place, you should use the
More responsibility is moving to the app and the app delegate. Now, iOS containers (such as
UINavigationController) do not consult their children to determine whether they should autorotate. By default, an app and a view controller’s supported interface orientations are set to
UIInterfaceOrientationMaskAllfor the iPad idiom and
UIInterfaceOrientationMaskAllButUpsideDownfor the iPhone idiom.
A view controller’s supported interface orientations can change over time—even an app’s supported interface orientations can change over time. The system asks the top-most full-screen view controller (typically the root view controller) for its supported interface orientations whenever the device rotates or whenever a view controller is presented with the full-screen modal presentation style. Moreover, the supported orientations are retrieved only if this view controller returns
shouldAutorotatemethod. The system intersects the view controller’s supported orientations with the app’s supported orientations (as determined by the
Info.plistfile or the app delegate’s
application:supportedInterfaceOrientationsForWindow:method) to determine whether to rotate.
The system determines whether an orientation is supported by intersecting the value returned by the app’s
supportedInterfaceOrientationsForWindow:method with the value returned by the
supportedInterfaceOrientationsmethod of the top-most full-screen controller.
setStatusBarOrientation:animated:method is not deprecated outright. It now works only if the
supportedInterfaceOrientationsmethod of the top-most full-screen view controller returns
0. This makes the caller responsible for ensuring that the status bar orientation is consistent.
didRotateFromInterfaceOrientation:methods are no longer called on any view controller that makes a full-screen presentation over itself—for example,
You should make sure that your apps are not using these methods to manage the layout of any subviews. Instead, they should use the view controller’s
viewWillLayoutSubviewsmethod and adjust the layout using the view’s bounds rectangle.
In iOS 6, the
UIViewControllerare now deprecated. If you were using these methods to release data, use the
didReceiveMemoryWarningmethod instead. You can also use this method to release references to the view controller’s view if it is not being used. You would need to test that the view is not in a window before doing this.