实现如下图所示:
在你的.h文件中添加 UIDocumentInteractionControllerDelegate
然后在.m文件中,新建一个方法,用来响应你点击按钮弹出时弹出popView,其中会罗列可打开当前文件的其他应用
我的方法如下
-(void)openDocumentIn{
documentController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:unEncodingURL]];
documentController.delegate = self;
documentController.UTI = @"com.microsoft.word.doc";
[documentController presentOpenInMenuFromRect:CGRectMake(760, 20, 100, 100) inView:self.view animated:YES];
}
其中
《1》 documentController.UTI 表示那些类型的文件支持第三方软件打开,此链接里面有各种类型文件对应的参数https://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
可用根据unEncodingURl中的文件后缀名去动态设置这个值
《2》rect 根据自己的需求写