Я следующий код для печати, я хочу, чтобы напечатать UIView контроллера представления о том, что класс прикреплен к,Air Печать из UIView создает белые страницы
но печать просто генерирует пустые белые страницы (и две страницы вместо одной)
Я довольно новичок в xcode, не могли бы вы помочь обнаружить ошибку?
UIPrintInteractionController *pc = [UIPrintInteractionController
sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"Print file";
pc.printInfo = printInfo;
UIViewPrintFormatter *Pformatter = [self.view viewPrintFormatter];
pc.printFormatter = Pformatter;
UIPrintInteractionCompletionHandler completionHandler =
^(UIPrintInteractionController *printController, BOOL completed,
NSError *error) {
if(!completed && error){
NSLog(@"Print failed - domain: %@ error code %u", error.domain,
error.code);
}
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[pc presentFromBarButtonItem:self.btnPrint animated:YES
completionHandler:completionHandler];
} else {
[pc presentAnimated:YES completionHandler:completionHandler];
}