Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example displays view settings bar and loading indicator, selects table cells and sets array of buttons for actions with report. The settings bar and loading indicator are hidden in three seconds after executing the example.
The environment console also displays the following information:
View state data size.
View contents screenshot size.
Indicates whether there are view controls.
Controller and view titles.
Number of controller settings.
Controller tag value.
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 table if([[contr delegate] mode] != kViewModeTable) [contr setDataViewMode:kViewModeTable]; // Get current controller MAGridDataViewController *activeController = (MAGridDataViewController *)[contr activeDataViewController]; // Inform delegate that handling of user actions is finished if(![activeController isAvailable]){ [[activeController delegate] dataViewController:activeController availabilityUpdated:YES]; } // Get controller view UIView *view = [activeController view]; // Get array of subviews NSArray *subviews = [view subviews]; // Parse subviews in cycle for(NSObject *subview in subviews) { // Check if the current view is a table view if([subview isMemberOfClass:[NuGridView class]]) { // Get table view object NuGridView *gView = (NuGridView *)subview; // Select table cells [[gView controller] selectAreaFromRow:[gView rowWithNumber:0] column:[gView columnWithNumber:0] toRow:[gView rowWithNumber:1] column:[gView columnWithNumber:1]]; // Refresh table [activeController updateDataWithGridSelection]; } } // Check if there is information about view state NSData *state = [[activeController delegate] stateForDataViewController:activeController]; if (state != nil){ GridDataViewDatasource *ds1 = [activeController gridDatasource]; // Load view settings [activeController loadState]; GridDataViewDatasource *ds2 = [activeController gridDatasource]; // If data source is changed, inform controller about source selection change if(ds1 != ds2){ [[activeController delegate] dataViewControllerChangedSelection:activeController]; } // Reload data [activeController reloadData]; // Save state [[activeController delegate] setState:state forDataViewController:activeController]; } else{ // Save view state [activeController saveState]; NSLog(@"View state data size: %i bytes", [[[contr delegate] gridState] length]); } // Generate view controller contents as a PDF file and display its size if(![activeController isDoingCalculations]){ if([activeController canGeneratePDFContent]){ [activeController generatePDFWithCompletionBlock:^(NSData * data) { NSLog(@"View controller contents size as a PDF file: %i bytes", [data length]); }]; } } // Set array of buttons for actions with report NSArray *buttons = [activeController barButtonItems]; if((buttons != nil) && ([buttons count] > 1)){ NSMutableArray *arr = [NSMutableArray arrayWithObject:buttons[0]]; [[activeController delegate] setBarButtonItems:arr forDataViewController:activeController]; } // Display controller contents screenshot size [[activeController delegate] dataViewControllerReadyForScreenshot:activeController]; CGSize s = [[activeController screenshot] size]; NSLog(@"Controller contents screenshot size: (%f x %f)", s.width, s.height); // Display information about view controller NSLog(@"Whether there are view controls: %hhd", [activeController hasControls]); [[activeController delegate] dataViewControllerReloadTitle:activeController]; if([activeController isDataViewTitleVisible]) NSLog(@"View title: %@", [activeController dataViewTitle]); NSLog(@"View controller title: %@", [activeController title]); NSLog(@"View tag value: %i", [activeController tag]); NSDictionary *config = [[activeController delegate] configurationForDataViewController:activeController]; NSLog(@"Number of controller settings: %i", [config count]); // Display loading indicator [[activeController delegate] dataViewControllerWillStartCalculations:activeController]; // Display view settings bar if([activeController isAvailable] && [activeController hasAppeared]){ if([activeController hasSettingsController]){ [[activeController delegate] dataViewController:activeController showSettingsController:[activeController settingsController] fromView:[activeController view]]; } } // 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; // Get current view id<MADataViewControllerProtocol> activeController = [contr activeDataViewController]; // Hide controller settings bar [[activeController delegate] dataViewControllerHideSettings:activeController]; // Hide loading indicator [[activeController delegate] dataViewControllerDidFinishCalculations:activeController]; }
After executing the example the view settings bar and the loading indicator are displayed:
The development environment console also displays information about the current view controller:
View state data size: 17707 bytes
Controller contents screenshot size: (444.000000 x 980.000000)
Whether there are view controls: 1
View controller title: Grid
View tag value: 0
Number of controller settings: 1
Controller contents size as a PDF file: 2748895 bytes
The settings bar and the loading indicator are hidden in three seconds after executing the example:
See also: