Working with Regular Report Page Selection View

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example describes some methods of working with regular report page selection view. After starting the example the following operations are executed:

Source Code

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

// Get regular report object
MAProceduralReportViewController *proceduralReportController = (MAProceduralReportViewController *)m_controller;
// get array of regular report data views
NSArray *dataViewControllers = [proceduralReportController dataViewControllers];
// Parse regular report views in cycle
for( UIViewController *controller in dataViewControllers)
{
    // Check if the current view is a regular report sheet viewer
    if([controller isMemberOfClass:[MAProceduralReportDataViewController class]])
    {
        // Get sheet viewer view
        MAProceduralReportDataViewController *dataViewController =(MAProceduralReportDataViewController *)controller;
        // Get regular report viewer view
        MAProceduralReportDataViewControllerBase *reportDataViewControllerBase = (MAProceduralReportDataViewControllerBase *)dataViewController;
        // Get page selection view
        PdfPageSelector *pageSelector = [reportDataViewControllerBase pageSelector];
        // Get page thumbnail size
        CGSize thumbnailSize = [pageSelector thumbnailSize];
        // Display page thumbnail height and width in the development environment console
        NSLog(@"Page thumbnail height: %f",thumbnailSize.height);
        NSLog(@"Page thumbnail width: %f",thumbnailSize.width);
        // Get array of thumbnail center coordinates
        NSMutableArray *coordinates = [pageSelector thumbnailsCoordinates];
        // Get first thumbnail coordinate in array
        float coordinate = [[coordinates objectAtIndex:0] floatValue];
        // Display first thumbnail coordinate in array in the development environment console
        NSLog(@"First thumbnail center coordinate in array of thumbnail center coordinates: %f", coordinate);
        // Display scrolling region height in the development environment console
        NSLog(@"Scrolling region height: %f",[pageSelector scrollingHeight]);
        // Find page index by specified vertical indent
        int pageForCoord = [pageSelector findPageNumberForYCoord:260];
        NSLog(@"Page index for indent 260: %d",pageForCoord);
        // Determine whether page selection view is hidden
        [pageSelector performSelector:@selector(setHidden:) withObject:[NSNumber numberWithBool: NO]];
    }
}

After executing the example the mobile device screen displays the regular report, for which page selection view is additionally drawn:

The development environment console also displays information on displaying the page selection view in regular report:

Page thumbnail height: 59.424404

Page thumbnail width: 42.000000

First thumbnail coordinate in array of thumbnail center coordinates: 49.712204

Scrolling region height: 337.122040

Page index for indent 260: 3

See also:

Examples of Component Use