Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismissing of UIPrintInteractionController

I'm using UIPrintInteractionController presenting it from rect.

UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
// than set printing settings
...
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    [controller presentFromRect:rect inView:view animated:YES completionHandler:completionHandler];

Than I set number of pages (>1) and select a printer. Before devices rotation I call

[controller dismissAnimated:animated];

according to Xcode documentation: You should dismiss the printing options when they are presented in a sheet or animated from a rectangle and the user changes the orientation of the device.

When I present UIPrintInteractionController after rotation, the number of printing copies is set back to 1 (as in initial view), whereas printer remains selected. Ivar _copies of UIPrintInfo is private, so I can't get it and store during rotation.

How can I restore the number of printing pages after rotation?

like image 607
Anastasia Avatar asked Nov 05 '12 15:11

Anastasia


2 Answers

Sorry this may seem a bit of an obvious question but have you called it as a delegate?

UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
controller.delegate = self;
like image 66
Joe Barbour Avatar answered Oct 31 '22 22:10

Joe Barbour


[printInfo setValue:[NSNumber numberWithInteger:numberFile] forKey:@"copies"]

You can set and set @"copies" of UIPrintInfo

like image 1
Nam Vu Avatar answered Oct 31 '22 22:10

Nam Vu