2

我使用 UIDocumentInteractionController presentOptionsMenuFromBarButtonItem 在 Adob​​e Reader 应用程序中打开 PDF,使用邮件发送并打印。邮件和打印工作正常,但我无法打开任何其他应用程序。我尝试了 presentOpenInMenuFromBarButtonItem 和 UIActivityViewController 但它们都没有满足我的所有需求。

我尝试使用 documentInteractionController: willBeginSendingToApplication: delegate 打开 Adob​​e Reader,但我无法找到如何将 pdf 传递给应用程序。可能吗?

如果没有,是否有另一种方法可以在 Adob​​e Reader 应用程序中打开 PDF,使用 Mail 发送并打印?

谢谢

4

1 回答 1

2

通常我是这样做的:

   NSURL *documentsDirectoryPath = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]];

    NSURL *URL =[documentsDirectoryPath URLByAppendingPathComponent:@"your pdf"];

    UIButton *button = (UIButton *)nil;
    self.documentInteractionController.delegate=self;
    if (URL) {
        // Initialize Document Interaction Controller
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
        // Configure Document Interaction Controller
        [self.documentInteractionController setDelegate:self];
        //preview
       [self.documentInteractionController presentPreviewAnimated:YES];
        // Present Open In Menu
        [self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];

    }
于 2015-10-15T19:17:30.177 回答