Displaying Control Bar

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays a full-screen loading indicator and a control bar. The development environment console also displays value of path to dashboard resources and the first dashboard block title.

Source Code

Executing the example requires to place the following code instead of the executeExample method of the ViewController class (see the Displaying of Dashboard section):

// Execute custom example placed in the body of this method
-(void) executeExample {
    // Get dashboard controller
    MADashboardReportViewController *dashboard = (MADashboardReportViewController *)m_controller;
    // Get the object used to work with dashboard
    id<MADashboardReportViewControllerDelegate> delegate = [dashboard delegate];
    // Display path to dashboard resources
    NSArray *resourcePath = [delegate dashboardResourcesPath];
    if ([resourcePath count] > 0) {
        NSLog(@"Path to dashboard resources: %@", (NSString *)[resourcePath objectAtIndex:0]);
    } else {
        NSLog(@"Resources are not specified");
    }
    // Get dashboard composite block
    NSMutableDictionary *compositeBlock = [[dashboard report] compositeBlocks];
    if ([compositeBlock count] > 0) {
        APCompositeBlock  *block =[compositeBlock allValues][0];
        // Get dashboard first block title
        NSString *blockTitle = [[dashboard report] titleForCompositeBlock:[block key]];
        NSLog(@"First block title: %@", blockTitle);
    } else {
        NSLog(@"Dashboard composite blocks are missing");
    }
    // Display full-screen loading indicator
    [[dashboard splitViewController] showFullScreenWaiter];
    // Start timer for 5 seconds
    [NSTimer scheduledTimerWithTimeInterval:5.0f target:self selector:@selector(timerEvent) userInfo:nil repeats:NO];
}
// Handle timer event
-(void) timerEvent {
    // Get dashboard controller
    MADashboardReportViewController *dashboard = (MADashboardReportViewController *) m_controller;
    // Hide full-screen loading indicator
    [[dashboard splitViewController] hideWaiter];
    // Get control bar view controller
    PanelViewController *panelViewCtrl = [dashboard panelViewController];
    if ([panelViewCtrl title]) {
        NSLog(@"Control bar title: %@", [panelViewCtrl title]);
    } else {
        NSLog(@"Control bar title is not specifiedf");
    }
}

As a result, the full-screen loading indicator is displayed:

The development environment console also displays value of path to dashboard resources and the first dashboard block title:

Path to dashboard resources: /Users/msn/Library/Application Support/iPhone Simulator/7.1/Applications/BCB0EE15-67C3-4B62-AF08-69FF1CF287A0/Documents/repositories/C6D1F3B71B945F5A5D708E56526E15AF/DASHBOARD_MOB6/DASHBOARD_MOB6.xml

First block title: Value, Data of Regional Economics and Programs departments, GROSS REGIONAL PRODUCT

The full-screen loading indicator is hidden in five seconds, the development environment console displays the control bar title or a notification that it is not specified:

Control bar title is not specified

See also:

Example of Component Use