2011-08-23 105 views

回答

1

擴展在jtbandes的答案,這裏是爲我工作的代碼:

NSURL *url = [NSURL fileURLWithPath:filePath]; 
UIDocumentInteractionController *popup = [UIDocumentInteractionController interactionControllerWithURL:url]; 
[popup setDelegate:self]; 
[popup presentPreviewAnimated:YES]; 

而且不要忘了,包括這個在您的.h文件:

@interface MyViewController : UIViewController <UIDocumentInteractionControllerDelegate> 

另外值得注意的:這將打開具有文檔查看器的新全屏視圖,以及提供所有可打開此文件的各種應用程序的「共享」按鈕。如果你只是在尋找共享彈出窗口,相當於UIActivityViewController,這將做到這一點,但有一些額外的功能,你可能不希望。

+0

任何人都可以給出答案在Swift中? –

相關問題