Reputation: 32104
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:
Upvotes: 2
Views: 4224
Reputation: 31
Use printInteractionControllerParentViewController
, the trick is to declare a UINavigationController *aNav;
in .h
and then in viewDidLoad
do aNav = [self UINavigationController];
this will save the navigationController
handle (assuming self is a UITableViewController
with UINavigationController
setup ok).
Then after invoke the uiprinterinteraction
, do aNav.topViewController.viw.backgroundColor = [UIColor redColor];
to change the uiprinterinteraction
background color to red.
Lastly, in printInteractionControllerParentViewController
do a return aNav;
Now you have successfully change the background color of the AirPrint ui.
By using this aNav
, you can do a lot of thing.
Upvotes: 3
Reputation: 32104
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
Upvotes: 1
Reputation: 5722
You could try to subclass UIPrintInteractionController, there's no hint in the Class Reference that it's not possible.
Upvotes: 0