iOS6.0后一些Rotations的变更

参考url:

点击链接打开

supportedInterfaceOrientationsForWindow:

Returns the default set of interface orientations to use for the view controllers in the specified window.

– ( NSUInteger )supportedInterfaceOrientationsForWindow:( UIWindow  *) window
Parameters
window

The window whose default interface orientations you want to retrieve.

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

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.

Availability
  • Available in iOS 6.0 and later.
Declared In

UIApplication.h

 

==========================================

参考URL:

点击链接打开

 

  • Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods.

    • 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 toUIInterfaceOrientationMaskAll for the iPad idiom and UIInterfaceOrientationMaskAllButUpsideDown for 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 YES from its shouldAutorotate method. 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: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 supportedInterfaceOrientations method of the top-most full-screen controller.

    • The setStatusBarOrientation:animated: method is not deprecated outright. It now works only if the supportedInterfaceOrientations method of the top-most full-screen view controller returns 0. This makes the caller responsible for ensuring that the status bar orientation is consistent.

  • The willRotateToInterfaceOrientation:duration:willAnimateRotationToInterfaceOrientation:duration:, and didRotateFromInterfaceOrientation: methods are no longer called on any view controller that makes a full-screen presentation over itself—for example,presentViewController:animated:completion:.

    • 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 viewWillLayoutSubviews method and adjust the layout using the view’s bounds rectangle.

  • In iOS 6, the viewWillUnload and viewDidUnload methods of UIViewController are now deprecated. If you were using these methods to release data, use the didReceiveMemoryWarning method 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.

你可能感兴趣的:(iOS6.0后一些Rotations的变更)