Instance Method


Inserts a specified child view controller into the childViewControllers array at a specified position.


- (void)insertChildViewController:(NSViewController *)childViewController atIndex:(NSInteger)index;



The child view controller to add to the childViewControllers array.


The index in the childViewControllers array at which to insert the child view controller. This value must not be greater than the count of elements in the array.


You should instead use the addChildViewController: method unless you want to perform work on child view controllers as you add them. In that case, override this method to perform that work.

If a child view controller has a different parent when you call this method, the child is first be removed from its existing parent by calling the child’s removeFromParentViewController method.

See Also

Managing Child View Controllers in a Custom Container

- addChildViewController:

A convenience method for adding a child view controller at the end of the childViewControllers array.


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

- transitionFromViewController:toViewController:options:completionHandler:

Performs a transition between two sibling child view controllers of the view controller.

- removeChildViewControllerAtIndex:

Removes a specified child controller from the view controller.

- removeFromParentViewController

Removes the called view controller from its parent view controller.

- preferredContentSizeDidChangeForViewController:

Called when there is a change in value of the preferredContentSize property of a child view controller or a presented view controller.