Ios 通过UIDocumentInteractionController允许PDF预览选项
大家好 我正在创建UIDocumentInteractionController以显示本地保存在我的应用程序文档文件夹中的.pdf文件。代码如下:Ios 通过UIDocumentInteractionController允许PDF预览选项,ios,pdf,uidocumentinteraction,Ios,Pdf,Uidocumentinteraction,大家好 我正在创建UIDocumentInteractionController以显示本地保存在我的应用程序文档文件夹中的.pdf文件。代码如下: if (theURLOfTheFile != nil && [theURLOfTheFile path] != nil && [[NSFileManager defaultManager] fileExistsAtPath:filePath]) { UIDocumentInter
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中打开它,它工作得很好。我想启用打印和复制功能:(使用
presentoptionmenufromrect:inView:animated:
而不是presentoppeninmenufromrect:inView:animated:
)
“OpenIn”方法仅显示其他应用程序。“Options”方法提供所有其他选项。如果我只想显示Whatsapp应用程序,我该怎么办?