我正在尝试修改使用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];
有一个代表你可以回复被叫:
- (UIViewController *)printInteractionControllerParentViewController:(UIPrintInteractionController *)printInteractionController
如果我从此返回nil,则会出现对话框.如果我返回导航视图控制器的视图控制器,则打印选项不会出现.我不知道为什么.
在一个相关的问题是,可以在不使用打印选项的情况下获得打印机列表,然后打印到特定的打印机(从而无需显示打印机选项视图).
最佳答案 至于修改对话框中出现的选项,您可以查看[UIPrintInfo]
object.您基本上设置了此对象,然后使用printInfo属性将其应用于UIPrintInteractionController.
关于使用导航控制器作为父级,我没有太多建议.我过去做过这件事没有任何问题.将父级设置为nil时,它将系统对话框显示为模式.将其设置为导航控制器时,它从侧面滑入,更像普通视图.我没有任何见解为什么它不适合你.抱歉!
至于没有对话的打印,我刚才回答了同样的基本问题:
iOS print without allowing UIPrintInteractionController to appear