Working with Container Divided into Two Data Views (Example 2)

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays working with a container divided into two data views. After starting the example the following operations are executed:

Source Code

Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Express Report section):

// Get express report controller
MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController *)m_controller;
// Get dimension panel container
PanelViewController *panelViewCtrl = [contr panelViewController];
// Create a controller for working with container divided into two data views
SplitViewController *splitController = [SplitViewController new];
// Load container
[splitController loadView];
// Get container divided into two data views
SplitView *splitView = [splitController splitView];
// Set container delegate
[splitView setDelegate: splitController];
// Set dimension panel container as the first data view
[splitView setFirstView: [panelViewCtrl view]];
// Create a table to be displayed as the second data view
UITableViewController *table = [UITableViewController new];
// Set the second data view
[splitView setSecondView: [table view]];
// Disable animation on changing separator position
[splitView setNoResizeUntilAnimated: YES];
// Display container divided into two views
[self showViewControllerInNavigationController: splitController];

After executing the example the container divided into two data views - dimension panel container and table - is displayed:

Then collapse the first data view, fix second data view size and set a new indent for it by adding the following code to the example:

// Deny user interaction with the second data view
[[splitView secondView] setUserInteractionEnabled: NO];
// Fix second data view size
[splitView setFixSecondViewSize: YES];
// Collapse the first data view
[splitView setFirstViewHidden: YES];
if ([splitView secondView].userInteractionEnabled == YES) {
    NSLog(@"Second data view is available for user interaction");
} else {
    NSLog(@"Second data view is not available for user interaction");
}
[[splitView delegate] splitView: splitView firstViewHiddenStateChanged:[splitView firstViewHidden]];
// Increase second data view indent from container left border
[splitView setHasControls: NO];
[splitView setOverlap: splitController.splitView.separatorPosition + 150];

After executing the example the first data view is collapsed, and the second data view indent is increased by 150 pixels:

The second data view size is fixed, and user interaction is enabled, which is displayed in the development environment console.

Delete the first data view and displays a full-screen loading indicator of the second data view by adding the following code to the example:

// Load container without the first data view
[splitView setNoFirstViewMode: YES];
// Specify that container does not contain controls
[splitView setHasControls: NO];
// Display full-screen loading indicator of the second data view
[splitView showFullScreenWaiter];

The second data view loading indicator can be displayed by the showWaiter method:

[splitView showWaiter];

To hide the second data view full-screen loading indicator, call the hideWaiter method:

[splitView hideWaiter];

After that the full-screen loading indicator is hidden:

See also:

Example of Component Use