通过UIDocumentInteractionController允许PDF的预览选项

时间:2014-03-25 04:28:17

标签: ios pdf uidocumentinteraction

Options available

大家好,

我正在创建一个UIDocumentInteractionController来显示一个.pdf文件,该文件本地保存在我的应用程序的文档文件夹中。这是代码:

   if (theURLOfTheFile != nil && [theURLOfTheFile path] != nil && [[NSFileManager     defaultManager] fileExistsAtPath:filePath])
    {

        UIDocumentInteractionController *myInteractionController = [self setupControllerWithURL:theURLOfTheFile usingDelegate:self];

        self.customInteractionController = myInteractionController;
        self.customInteractionController.UTI = @"com.adobe.pdf";
        self.customInteractionController.delegate = self;
#define abf self.actionButton.frame

        //SPOT THE DIFFERENCE:


        if (!_interactionControllerVisible) {
            BOOL isValid = [self.customInteractionController presentOpenInMenuFromRect:CGRectMake(self.view.frame.size.height-100, 100, 500, 500) inView:self.view animated:YES];
        }




    } else {
        NSLog(@"Failed to open file. EscapedURL: %@",filePath);
    }

我没有获得预览选项,但我可以在iBooks中打开它,它运行得很好。我想启用打印和复印。 :(

1 个答案:

答案 0 :(得分:1)

使用presentOptionsMenuFromRect:inView:animated:代替presentOpenInMenuFromRect:inView:animated:

" OpenIn"方法只显示其他应用程序。 "选项"方法提供了所有其他选项。