Instance Method

addChildViewController:

Adds the specified view controller as a child of the current view controller.

Declaration

- (void)addChildViewController:(UIViewController *)childController;

Parameters

childController

The view controller to be added as a child.

Discussion

This method creates a parent-child relationship between the current view controller and the object in the childController parameter. This relationship is necessary when embedding the child view controller’s view into the current view controller’s content. If the new child view controller is already the child of a container view controller, it is removed from that container before being added.

This method is only intended to be called by an implementation of a custom container view controller. If you override this method, you must call super in your implementation.

See Also

Managing Child View Controllers in a Custom Container

childViewControllers

An array of view controllers that are children of the current view controller.

- removeFromParentViewController

Removes the view controller from its parent.

- transitionFromViewController:toViewController:duration:options:animations:completion:

Transitions between two of the view controller'€™s child view controllers.

shouldAutomaticallyForwardAppearanceMethods

Returns a Boolean value indicating whether appearance methods are forwarded to child view controllers.

- beginAppearanceTransition:animated:

Tells a child controller its appearance is about to change.

- endAppearanceTransition

Tells a child controller its appearance has changed.

- setOverrideTraitCollection:forChildViewController:

Changes the traits assigned to the specified child view controller.

- overrideTraitCollectionForChildViewController:

Retrieves the trait collection for a child view controller.

UIViewControllerHierarchyInconsistencyException

Raised if the view controller hierarchy is inconsistent with the view hierarchy.