2014-03-25 81 views
1

Options available通過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的打開它,它工作得很好。我想啓用打印和複印。 :(

回答

1

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

的「OpenIn」的方法只能說明其他應用程序。「選項」方法給出了所有的其他選項。

+0

這個工作,A ++會再問。 –

+0

如果我只想顯示WhatsApp應用程序我該怎麼做? –

相關問題