在做好解压缩以及文件打开之后,说界面难看,醉了,不得已又开始研究调用第三方打开文件,以WPS为例
首先判断设备上是否安装有WPS
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"KingsoftOfficeApp://"]]){
//说明此设备有安装app
NSLog(@"安装");
}else{
//说明此设备没有安装app
NSLog(@"没有安装");
};
在此提供一些常用的第三方APP的url scheme
微信 :weixin://
高德地图:iosamap://
淘宝网:taobao://
支付宝:alipay://
新浪微博:weibo://
优酷:youku://
知乎:zhihu://
WPS:KingsoftOfficeApp://
接下来使用 UIDocumentInteractionController 就可以将文件分享出去打开
@property (nonatomic, strong) UIDocumentInteractionController *documentVC;
需要遵循代理
<UIDocumentInteractionControllerDelegate>
随后在需要的地方
- (void)showDocumentVCPath:(NSString *)pathUrl {
self.documentVC = [[UIDocumentInteractionController alloc]init];
NSString *pathStr = [NSString stringWithFormat:@"file://%@",pathUrl];
self.documentVC = [UIDocumentInteractionController interactionControllerWithURL:[NSURL URLWithString:pathStr]];
[self.documentVC setDelegate:self];
[self.documentVC presentOpenInMenuFromRect:CGRectZero inView:self.viewController.view animated:YES];
}