Displaying Report Action Bar

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example displays a popup window with a report action bar. The development environment console also displays description of report contents screenshot, report title and report PDF file size.

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):

// Function for example execution
-(void) executeExample {
    // Get report view controller
    MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController*)m_controller;
    // Load report state if there is state data
    if([[contr delegate] reportState] != nil)
        [contr loadState];
    else
        [contr saveState];
    // Display report contents screenshot description
    printf("\nReport contents screenshot description: %s\n\n", [[[contr screenshot] description] UTF8String]);
    // Display report title
    printf("\nReport title: %s\n\n", [[contr reportTitle] UTF8String]);
    if([[contr reportTitle] compare: [contr pdfContentTitle]] != NSComparisonResult::NSOrderedSame){
        // Display report PDF file title
        printf("\nReport PDF file title: %s\n\n", [[contr pdfContentTitle] UTF8String]);
    }
    // Display report PDF file size
    if([contr canGeneratePDFContent]){
        [contr generatePDFWithCompletionBlock:^(NSData * data) {
            printf("\nReport PDF file size: %i bytes\n\n", [data length]);
        }];
    }
    // Display report action bar
    CGRect r = CGRectMake(50, 50, 0, 0);
    [contr showInPopover:[contr reportActionsController] fromView:[self view] inRect:r permittedArrowDirections: UIPopoverArrowDirectionLeft];
    // Start timer for 3 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;
    // Hide action bar over report
    if([contr isPopoverShown])
        [contr hidePopover];
}

It is also required to replace the code in the static example file MAExpressAnalysisReportViewController.mm in the initWithDelegate: method with the following code:

// Initialize controller base class
if ((self = [super initWithDelegate: delegate])) {
    NSAssert(self.delegate, @"ReportDelegate not nil");
    // Create a dimension panel controller
    m_panelViewController = [PanelViewController new];
    [m_panelViewController setPanelTitle:NSLocalizedString(@"Layout", @"DimPanel:Title")];
    // Create a report split view controller with sliding dimension panel
    m_splitViewController = [SplitViewController new];
    m_splitViewController.panelViewController = m_panelViewController;
    NNotificationCenterExt::addObserver(self, @selector(updateSplitViewTitle), kSetTimeLineCurrentIndex, nil);
}
return self;

After executing the example a popup window with report action bar is displayed:

The popup window is hidden in three seconds after displaying the panel.

The development environment console also displays report information:

Report contents screenshot description: <UIImage: 0x12db2110>

Report title: GDP per capita, PPP (constant 2005 international $)

Report PDF file size: 76268 bytes

See also:

Example of Component Use