Reputation: 41
I am trying to modify the printing options that appear when using UIPrint.
UIPrintInteractionController *pic;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"Printing could not complete because of error: %@", error);
}
};
[pic presentAnimated:YES completionHandler:completionHandler];
There is a delegate that you can respond to called:
- (UIViewController *)printInteractionControllerParentViewController:(UIPrintInteractionController *)printInteractionController
If I return nil from this, the dialog shows up. If I return a view controller of navigation view controller, then the print options don't come up. I have no idea why.
On a related question is it possible to get a list of printers without using the print options at all and then print to a particular printer (thereby losing the need of having to show the printer options view).
Upvotes: 4
Views: 1094
Reputation: 91
As for modifying the options that appear in the dialog, you might look at the [UIPrintInfo]
object. You basically setup this object and then apply it to the UIPrintInteractionController
using the printInfo
property.
I don’t have much advice on using the navigation controller as the parent. I’ve done that in the past with no issues. When setting the parent to nil it shows the system dialog as a modal. When setting it to the navigation controller it slides in from the side more like a normal view. I don’t have any insight why it’s not working for you. Sorry!
As for printing without a dialog, I just answered the same basic question here:
iOS print without allowing UIPrintInteractionController to appear
Upvotes: 2