Unable to display printer options with AirPrint

梦想与她 提交于 2019-12-23 01:18:10

问题


I want to add AirPrint functionality to my iPad application

I have been trying to display printer ontions described in Apple's Drawing and Printing Guide

I have toolbar and UIBarButtonItem *printButton. In controller I receive onPrintClick and try to display printer options by such code:

UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
 [controller setDelegate:self];
 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  [controller presentFromBarButtonItem:self.printButton animated:YES
         completionHandler:completionHandler];
 } else {
  [controller presentAnimated:YES completionHandler:nil];
 }

Please help, because I do receive nothing :(


回答1:


You need to set printItem/printItems property in order to use an AirPrint.

controller.printItem = a URL to PDF or image file;



回答2:


I've used this personally on an iPad app: Including AirPrint on an iOS App



来源:https://stackoverflow.com/questions/4275646/unable-to-display-printer-options-with-airprint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!