4

我正在尝试修改使用 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,则会显示对话框。如果我返回导航视图控制器的视图控制器,则不会出现打印选项。我不知道为什么。

在一个相关的问题上,是否可以在不使用打印选项的情况下获取打印机列表,然后打印到特定的打印机(从而无需显示打印机选项视图)。

4

1 回答 1

2

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

于 2014-10-08T18:14:48.923 回答