Instance Method

willMoveToParentViewController:

Called just before the view controller is added or removed from a container view controller.

Declaration

- (void)willMoveToParentViewController:(UIViewController *)parent;

Parameters

parent

The parent view controller, or nil if there is no parent.

Discussion

Your view controller can override this method when it needs to know that it has been added to a container.

If you are implementing your own container view controller, it must call the willMoveToParentViewController: method of the child view controller before calling the removeFromParentViewController method, passing in a parent value of nil.

When your custom container calls the addChildViewController: method, it automatically calls the willMoveToParentViewController: method of the view controller to be added as a child before adding it.

See Also

Responding to Containment Events

- didMoveToParentViewController:

Called after the view controller is added or removed from a container view controller.