Working with Dimension Panel Controller (Example 2)

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays dimension panel controller view, determines the number of dimensions and table cells on this panel.

Required Files

It is required to add the following file to the base example Displaying of Express Report:

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 express report delegate
EAReportDelegateImpl *delegate = [contr delegate];
// Get dimension panel
id dimensionsPanel = [delegate dimensionsPanel];
NSLog(@"Number of dimensions: %d", [dimensionsPanel dimensionsCount]);
if([dimensionsPanel tableView] != nil) {
    UITableView *tableView = [dimensionsPanel tableView];
    NSLog(@"Number of table cells: %d", [tableView numberOfRowsInSection:0]);
    } else {
    NSLog(@"table view is not specified");
}
// Create an object for working with table on dimension panel
DimensionsPanelTableProtocolImpl *dimensionsPanelTableDelegate = [DimensionsPanelTableProtocolImpl new];
[dimensionsPanelTableDelegate setDimensionsPanel: dimensionsPanel];
// Refresh dimension panel
[dimensionsPanelTableDelegate update];
// Delete all window subviews
NSArray *subviews = [self.view subviews];
for(UIView *subView in subviews)
{
    [subView removeFromSuperview];
}
// Display dimension panel
[self.view addSubview: [dimensionsPanel view]];

After executing the example the mobile device screen displays the data source dimension panel:

The development environment console displays the following information: the number of data source dimensions, the number of table cells on the panel, the notification about panel data refresh:

Number of dimensions: 3

Number of table cells: 3

Dimension panel data is refreshed


Example execution result remains the same if the code string:

[dimensionsPanelTableDelegate update];

is replaced with the following string:

[dimensionsPanelTableDelegate deepUpdate];

The development environment console still displays the notification about dimension panel data refresh.

See also:

Examples of Component Use