Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes creating a regular report sheet viewer. After starting the example the following operations are executed:
Regular report view is retrieved.
Regular report sheet viewer view is retrieved.
Regular report data source is retrieved from regular report sheet viewer view.
A new regular report sheet viewer view is created.
Regular report viewer view is retrieved from the created view.
PNG data of the first report page for screenshot is retrieved from the obtained viewer view.
An image based on obtained PNG data is created.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Regular Report section):
// Delete all window subviews NSArray *reportSubviews = [self.view subviews]; for(UIView *subView in reportSubviews) { [subView removeFromSuperview]; } // Get regular report view MAProceduralReportViewController *proceduralReportController = (MAProceduralReportViewController *)m_controller; // Get array of regular report views NSArray *dataViewControllers = [proceduralReportController dataViewControllers]; // Parse regular report views in cycle for( UIViewController *controller in dataViewControllers) { // Check if the current view is a sheet viewer if([controller isMemberOfClass:[MAProceduralReportDataViewController class]]) { // Get sheet viewer view MAProceduralReportDataViewController *dataViewController =(MAProceduralReportDataViewController *)controller; // Get regular report data source from sheet viewer view id<MAProceduralReportViewControllerDelegate> dataSource = [dataViewController dataSource]; // Create a new sheet viewer view MAProceduralReportDataViewController *createdDataViewController = [[MAProceduralReportDataViewController alloc] initWithDataSource:dataSource]; // Get regular report viewer view MAProceduralReportDataViewControllerBase *reportDataViewControllerBase = (MAProceduralReportDataViewControllerBase *)createdDataViewController; // Get PNG data of report first page for screenshot NSData *firstPageData = [reportDataViewControllerBase prepareScreenshotOfTheFirstPage]; // Create an image based on obtained data UIImage *image = [[UIImage alloc] initWithData:firstPageData]; // Set window background color [self.view setBackgroundColor:[UIColor whiteColor]]; // Display obtained image in the mobile device screen UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [self.view addSubview:imageView]; } }
After executing the example the mobile device screen displays a thumbnail of the regular report first page:
See also: