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 the UIInterfaceOrientation enum.

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.0 and later.
  • Deprecated in iOS 5.0.
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.
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 the UIInterfaceOrientation enum.

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.
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.
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.
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.
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

In iOS 5 and earlier, when a low-memory condition occurred and the current view controller’s views were not needed, the system could opt to call this method after the view controller’s view had been released. This method was your chance to perform any final cleanup. If your view controller stored separate references to the view or its subviews, you could use this method to release those references. You could 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 would not use this method to release user data or any other information that cannot be easily recreated.

In iOS 6 and later, clearing references to views and other objects in your view controller is unnecessary.

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.
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

In iOS 5 and earlier, when a low-memory condition occurred and the current view controller’s views were not needed, the system could opt to remove those views from memory. This method was called prior to releasing the actual views so you could perform any cleanup prior to the view being deallocated. For example, you could 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.

In iOS 6 and later, clearing references to views is no longer necessary. As a result, any other cleanup related to those views, such as removing them as observers, is also not necessary.

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

Deprecated in iOS 7.0

contentSizeForViewInPopover

The size of the view controller’s view while displayed in a popover. (Deprecated in iOS 7.0.)

@property(nonatomic, readwrite) CGSize contentSizeForViewInPopover
Discussion

This property contains the desired size for the view controller when it is displayed in a popover. By default, the width is set to 320 points and the height is set to 1100 points. You can change these values as needed.

The recommended width for popovers is 320 points. If needed, you can return a width value as large as 600 points, but doing so is not recommended.

If the popover controller displaying the view controller sets its popoverContentSize property, the popover controller overrides the values set in the view controller’s contentSizeForViewInPopover property.

Availability
  • Available in iOS 3.2 and later.
  • Deprecated in iOS 7.0.
Declared In
UIPopoverController.h

wantsFullScreenLayout

A Boolean value indicating whether the view should underlap the status bar. (Deprecated in iOS 7.0.)

@property(nonatomic, assign) BOOL wantsFullScreenLayout
Discussion

When a view controller presents its view, it normally shrinks that view so that its frame does not overlap the device’s status bar. Setting this property to YES causes the view controller to size its view so that it fills the entire screen, including the area under the status bar. (Of course, for this to happen, the window hosting the view controller must itself be sized to fill the entire screen, including the area underneath the status bar.) You would typically set this property to YES in cases where you have a translucent status bar and want your view’s content to be visible behind that view.

If this property is YES, the view is not resized in a way that would cause it to underlap a tab bar but is resized to underlap translucent toolbars. Regardless of the value of this property, navigation controllers always allow views to underlap translucent navigation bars.

The default value of this property is NO, which causes the view to be laid out so it does not underlap the status bar.

Availability
  • Available in iOS 3.0 and later.
  • Deprecated in iOS 7.0.
Related Sample Code
Declared In
UIViewController.h