aBigRoybot

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

Next

Previous

Deprecated UIViewController Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in iOS 5.0

didAnimateFirstHalfOfRotationToInterfaceOrientation:

Sent to the view controller after the completion of the first half of the user interface rotation. (Deprecated in iOS 5.0. Use the one-step rotation technique instead. See the willAnimateRotationToInterfaceOrientation:duration: method.)

- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

Parameters

toInterfaceOrientation

The state of the app’s user interface orientation after the rotation. The possible values are described in UIInterfaceOrientation.

Discussion

This method is called during two-step rotation animations only. Subclasses can override this method and use it to adjust their views between the first and second half of the animations. This method is called outside of any animation transactions and while any header or footer views are offscreen.

Availability

  • Available in iOS 2.1 and later.
  • Deprecated in iOS 5.0.

See Also

  • – willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
  • – willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

Declared In

UIViewController.h

willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:

Sent to the view controller before performing the first half of a user interface rotation. (Deprecated in iOS 5.0. Use the one-step rotation technique instead. See the willAnimateRotationToInterfaceOrientation:duration: method.)

- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

Parameters

toInterfaceOrientation

The state of the app’s user interface orientation before the rotation. The possible values are described in UIInterfaceOrientation.

duration

The duration of the first half of the pending rotation, measured in seconds.

Discussion

The default implementation of this method does nothing.

This method is called from within the animation block used to rotate the view and slide the header and footer views out. You can override this method and use it to configure additional animations that should occur during the first half of the view rotation. For example, you could use it to adjust the zoom level of your content, change the scroller position, or modify other animatable properties of your view.

At the time this method is called, the interfaceOrientation property is still set to the old orientation.

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 5.0.

See Also

Declared In

UIViewController.h

willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

Sent to the view controller before the second half of the user interface rotates. (Deprecated in iOS 5.0. Use the one-step rotation technique instead. See the willAnimateRotationToInterfaceOrientation:duration: method.)

- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration

Parameters

fromInterfaceOrientation

The state of the app’s user interface orientation before the rotation. The possible values are described in UIInterfaceOrientation.

duration

The duration of the second half of the pending rotation, measured in seconds.

Discussion

The default implementation of this method does nothing.

This method is called from inside the animation block used to finish the view rotation and slide the header and footer views back into position. You can override this method and use it to configure additional animations that should occur during the second half of the view rotation. For example, you could use it to adjust the zoom level of your content, change the scroller position, or modify other animatable properties of your view.

At the time this method is invoked, the interfaceOrientation property is set to the new orientation.

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 5.0.

See Also

Declared In

UIViewController.h

Deprecated in iOS 6.0

modalViewController

The controller for the active presented view—that is, the view that is temporarily displayed on top of the view managed by the receiver. (read-only) (Deprecated in iOS 6.0. Use presentedViewController instead.)

@property(nonatomic, readonly) UIViewController *modalViewController

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 6.0.

Related Sample Code

Declared In

UIViewController.h

automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers

Returns a Boolean value that indicates whether appearance and rotation methods are forwarded. (Deprecated in iOS 6.0. Use shouldAutomaticallyForwardRotationMethods and shouldAutomaticallyForwardAppearanceMethods instead.)

- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers

Return Value

A Boolean value that indicates whether appearance and rotation methods are forwarded.

Discussion

This method is called to determine whether to automatically forward containment callbacks to the child view controllers.

The default implementation returns YES. Subclasses of the UIViewController class that implement containment logic may override this method to control how these methods are forwarded. If you override this method and return NO, you are responsible for forwarding the following methods to child view controllers at the appropriate times:

Availability

  • Available in iOS 5.0 and later.
  • Deprecated in iOS 6.0.

Declared In

UIViewController.h

dismissModalViewControllerAnimated:

Dismisses the view controller that was presented by the receiver. (Deprecated in iOS 6.0. Use dismissViewControllerAnimated:completion: instead.)

- (void)dismissModalViewControllerAnimated:(BOOL)animated

Parameters

animated

If YES, this method animates the view as it’s dismissed; otherwise, it does not. The style of animation is determined by the value in the modalTransitionStyle property of the view controller being dismissed.

Discussion

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, however, it automatically forwards the message to the presenting view controller.

If you present several view controllers in succession, and thus build a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.

If you want to retain a reference to the receiver’s presented view controller, get the value in the modalViewController property before calling this method.

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 6.0.

Related Sample Code

Declared In

UIViewController.h

presentModalViewController:animated:

Presents a modal view managed by the given view controller to the user. (Deprecated in iOS 6.0. Use presentViewController:animated:completion: instead.)

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated

Parameters

modalViewController

The view controller that manages the modal view.

animated

If YES, animates the view as it’s presented; otherwise, does not.

Discussion

On iPhone and iPod touch devices, the view of modalViewController is always presented full screen. On iPad, the presentation depends on the value in the modalPresentationStyle property.

Sets the modalViewController property to the specified view controller. Resizes its view and attaches it to the view hierarchy. The view is animated according to the transition style specified in the modalTransitionStyle property of the controller in the modalViewController parameter.

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 6.0.

See Also

  • – dismissModalViewControllerAnimated:

Related Sample Code

Declared In

UIViewController.h

shouldAutorotateToInterfaceOrientation:

Returns a Boolean value indicating whether the view controller supports the specified orientation. (Deprecated in iOS 6.0. Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

Parameters

interfaceOrientation

The orientation of the app’s user interface after the rotation. The possible values are described in UIInterfaceOrientation.

Return Value

YES if the view controller auto-rotates its view to the specified orientation; otherwise, NO.

Discussion

By default, this method returns YES for the UIInterfaceOrientationPortrait orientation only. If your view controller supports additional orientations, override this method and return YES for all orientations it supports.

Your implementation of this method should simply return YES or NO based on the value in the interfaceOrientation parameter. Do not attempt to get the value of the interfaceOrientation property or check the orientation value reported by the UIDevice class. Your view controller is either capable of supporting a given orientation or it is not.

Availability

  • Available in iOS 2.0 and later.
  • Deprecated in iOS 6.0.

See Also

Declared In

UIViewController.h

viewDidUnload

Called when the controller’s view is released from memory. (Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.)

- (void)viewDidUnload

Discussion

When a low-memory condition occurs and the current view controller’s views are not needed, the system may opt to remove those views from memory. This method is called after the view controller’s view has been released and is your chance to perform any final cleanup. If your view controller stores separate references to the view or its subviews, you should use this method to release those references. You can also use this method to remove references to any objects that you created to support the view but that are no longer needed now that the view is gone. You should not use this method to release user data or any other information that cannot be easily recreated.

At the time this method is called, the view property is nil.

Availability

  • Available in iOS 3.0 and later.
  • Deprecated in iOS 6.0.

Related Sample Code

Declared In

UIViewController.h

viewWillUnload

Called just before releasing the controller’s view from memory. (Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.)

- (void)viewWillUnload

Discussion

When a low-memory condition occurs and the current view controller’s views are not needed, the system may opt to remove those views from memory. This method is called prior to releasing the actual views so you can perform any cleanup prior to the view being deallocated. For example, you might use this method to remove views as observers of notifications or record the state of the views so it can be reestablished when the views are reloaded.

At the time this method is called, the view property is still valid (it has not yet been set to nil).

Availability

  • Available in iOS 5.0 and later.
  • Deprecated in iOS 6.0.

Declared In

UIViewController.h

Next

Previous

 

 

 

© 2012 Apple Inc. All Rights Reserved. (Last updated: iOS 6.0)

Did this document help you? YesIt's good, but...Not helpful...

posted on 2012-10-08 20:57  aBigRoybot  阅读(950)  评论(0编辑  收藏  举报