Instance Method

splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:

Asks the delegate to adjust the primary view controller and to incorporate the secondary view controller into the collapsed interface.

Declaration

- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController;

Parameters

splitViewController

The split view controller whose interface is collapsing.

secondaryViewController

The secondary view controller of the split view interface.

primaryViewController

The primary view controller of the split view interface. If you implement the primaryViewControllerForCollapsingSplitViewController: method in your delegate, this object is the one returned by that method.

Return Value

NO to let the split view controller try and incorporate the secondary view controller’s content into the collapsed interface or YES to indicate that you do not want the split view controller to do anything with the secondary view controller.

Discussion

This method is your opportunity to perform any necessary tasks related to the transition to a collapsed interface. After this method returns, the split view controller removes the secondary view controller from its viewControllers array, leaving the primary view controller as its only child. In your implementation of this method, you might prepare the primary view controller for display in a compact environment or you might attempt to incorporate the secondary view controller’s content into the newly collapsed interface.

Returning NO tells the split view controller to use its default behavior to try and incorporate the secondary view controller into the collapsed interface. When you return NO, the split view controller calls the collapseSecondaryViewController:forSplitViewController: method of the primary view controller, giving it a chance to do something with the secondary view controller’s content. Most view controllers do nothing by default but the UINavigationController class responds by pushing the secondary view controller onto its navigation stack.

Returning YES from this method tells the split view controller not to apply any default behavior. You might return YES in cases where you do not want the secondary view controller’s content incorporated into the resulting interface.

See Also

Collapsing and Expanding the Interface

- primaryViewControllerForCollapsingSplitViewController:

Asks the delegate to provide the single view controller to display after the split view interface collapses.

- primaryViewControllerForExpandingSplitViewController:

Asks the delegate to provide the view controller to display in the primary position when the split view interface expands.

- splitViewController:separateSecondaryViewControllerFromPrimaryViewController:

Asks the delegate to provide the new secondary view controller for the split view interface.