1
通過UIDocumentInteractionController
大家允許預覽選項爲PDF,
我創建一個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的打開它,它工作得很好。我想啓用打印和複印。 :(
這個工作,A ++會再問。 –
如果我只想顯示WhatsApp應用程序我該怎麼做? –