Search code examples
iphoneobjective-ccocoa-touchairprint

Custom printing options using AirPrint and UIPrintInteractionController


I've successfully added printing capabilities to an iPad application that makes use of the UIPrintInteractionController class. Things work well, and a standard document is printed.

There are a couple BOOL properties that can be defined for a print job in my application, however. (Turning on certain features, adding additional layout schemes, etc.)

How can these options be presented/modified by the user using the UIPrintInteractionController? The perfect solution would be to add a couple switch table view cells to the UITableView that is presented in that controller, but this doesn't seem to be allowed by the API.

Edit: This is the view I'm referring to:

enter image description here


Solution

  • It looks like the best bet (so far) is to assign a delegate to the UIPrintInteractionController, and have that delegate implement the method:

    - (UIViewController *)printInteractionControllerParentViewController:(UIPrintInteractionController *)printInteractionController
    

    If the delegate returns an instance of a UINavigationController, then instead of being presented modally, it can be pushed from a UITableViewController subclass that provides a list of options.

    From the UIPrintInteractionControllerDelegate class reference:

    UIKit can push the returned view controller onto the stack if its parent is a navigation controller or present it modally if it isn’t.

    UIPrintInteractionControllerDelegate Class Reference