2011-08-23 118 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中? –

相关问题