Customizing the PSPDFAnnotationTableViewController

Here are two approaches to customize settings in the PSPDFAnnotationTableViewController:

1) Subclass the view controller, then register your subclass overrideClass:withClass: in the PSPDFConfigurationBuilder. Configure any properties in the init method of the subclass.

2) Use the shouldShowController: delegate:

This is a bit tedious since the annotation controller is packed inside a container view controller, unless all other view controller options are disabled in the outline bar button.

Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static id PSCControllerForClass(id theController, Class klass) {
    if ([theController isKindOfClass:klass]) {
        return theController;
    }else if ([theController isKindOfClass:UINavigationController.class]) {
        return PSCControllerForClass(((UINavigationController *)theController).topViewController, klass);
    }else if ([theController isKindOfClass:PSPDFContainerViewController.class]) {
        for (UIViewController *contained in ((PSPDFContainerViewController *)theController).viewControllers) {
            if (PSCControllerForClass(contained, klass)) return PSCControllerForClass(contained, klass);
        }
    }
    return nil;
}

- (BOOL)pdfViewController:(PSPDFViewController *)pdfController shouldShowController:(id)controller embeddedInController:(id)hostController options:(NSDictionary *)options animated:(BOOL)animated {
    PSCLog(@"shouldShowViewController: %@ embeddedIn:%@ animated: %d.", controller, controller, animated);

    PSPDFAnnotationTableViewController *annotCtrl = PSCControllerForClass(controller, PSPDFAnnotationTableViewController.class);
    annotCtrl.showDeleteAllOption = NO;

    return YES;
}