Instance Method

transitionFromViewController:toViewController:options:completionHandler:

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

Declaration

- (void)transitionFromViewController:(NSViewController *)fromViewController toViewController:(NSViewController *)toViewController options:(NSViewControllerTransitionOptions)options completionHandler:(void (^)(void))completion;

Parameters

fromViewController

A child view controller whose view is visible in the view controller’s view hierarchy.

toViewController

A child view controller whose view is not in the view controller’s view hierarchy.

options

A bitmask of options that specify how you want to perform the transition animation. For the options, see the NSViewControllerTransitionOptions enumeration.

completion

A block called immediately after the transition animation completes.

Discussion

Use this method to transition between sibling child view controllers owned by a parent view controller (which is the receiver of this method).

This method adds the view in the toViewController view controller to the superview of the view in the fromViewController view controller. Likewise, this method removes the fromViewController view from the parent view controller’s view hierarchy at the appropriate time. It is important to allow this method to add and remove these views.

To create a parent/child relationship between view controllers, use the addChildViewController: method or the insertChildViewController:atIndex: 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.

childViewControllers

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

- insertChildViewController:atIndex:

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

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