Displaying Report Action Bar and Settings Panel of Current Data View

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays a view that follows the current view and a report action bar. The settings bar of the current data view is displayed in three seconds after executing the example. The environment console also displays the following information:

Source Code

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

// Execute custom example
-(void) executeExample {
    // Get report view controller
    MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController*)m_controller;
    // Display views with the following index after the current one
    [contr setDataViewControllerWithIndex: [contr selectedDataViewControllerIndex] + 1];
    // Get current view
    id<MADataViewControllerProtocol> activeController = [contr activeDataViewController];
    // Display information about current view
    NSLog(@"Current view index: %i", [MAExpressAnalysisReportViewController selectedIndex]);
    NSLog(@"Whether title is displayed: %hhd", [contr showTitle]);
    NSLog(@"Current view title: %@", [activeController title]);
    NSLog(@"Number of report views: %i", [[contr dataViewControllers] count]);
    NSLog(@"Number of buttons created to execute actions with report: %i", [[contr createRightBarButtonItems] count]);
    if([contr hasSettingsController]){
        // Get report settings controller
        BaseSettingsViewController *reportSettings = (BaseSettingsViewController*)[contr reportSettingsController];
        // Get cell with switch
        SettingsSwitchTableViewCell *switchCell = [[reportSettings cells] allValues][0];
        // Set switch state
        [switchCell switchToStateOn:NO];
    }
    // Display report action bar
    UIViewController<PopoverContainedControllerProtocol> *reportActionsController = [contr reportActionsController];
    CGRect rect = CGRectMake(50, 50, 0, 0);
    [contr showInPopover:reportActionsController fromView:[self view] inRect:rect permittedArrowDirections:UIPopoverArrowDirectionAny];
    // Start time for three seconds
    [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(timerEvent) userInfo:nil repeats:NO];
}
// Handle timer event
- (void) timerEvent{
    // Get report view controller
    MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController*)m_controller;
    // Display data view settings bar
    CGRect rect2 = CGRectMake(250, 250, 0, 0);
    UIViewController<PopoverContainedControllerProtocol> *viewSettingsController = [contr viewSettingsController];
    [contr showInPopover:viewSettingsController fromView:[self view] inRect:rect2 permittedArrowDirections:UIPopoverArrowDirectionAny];
}

After executing the example the view with the index that follows the current view index is displayed, the report action bar is displayed:

The development environment console also displays report information:

Current view index: 1

Whether title is displayed: 1

Current view title: Chart

Number of report views: 4

Number of buttons created to execute actions with report: 5

The current view settings bar is displayed in three seconds:

See also:

Example of Component Use