• iOS 里面如何使用第三方应用程序打开自己的文件,调用wps其他应用打开当前应用里面的的ppt doc xls


     我们的自己的应用里面经常涉及的要打开ppt doc,这样的功能,以前总以为iOS沙盒封闭化,不可能实现,后来终于解决了

    使用

    UIDocumentInteractionController 来解决这一问题

    使用下面代码,就可以打开airdrop ,然后你选择wps , 打开文档,OK 

    - (IBAction)download:(id)sender {

       

        NSString* path = [[NSBundlemainBundle] pathForResource:@"aa"ofType:@"docx"];

        NSURL *file_URL = [NSURL fileURLWithPath:path];

        

        NSFileManager* fileManager = [NSFileManagerdefaultManager];

        if ([fileManager fileExistsAtPath:path]) {

            if (self.fileInteractionController == nil) {

                fileInteractionController = [[UIDocumentInteractionControlleralloc] init];

                

                fileInteractionController = [UIDocumentInteractionControllerinteractionControllerWithURL:file_URL];

                fileInteractionController.delegate = self;

                //[fileInteractionController retain];

                

            }else {

                self.fileInteractionController.URL = file_URL;

            }

            

            [self.fileInteractionControllerpresentPreviewAnimated:YES];

            

        }

        

    }

  • 相关阅读:
    Web 前端 UI 组件库文档自动化方案 All In One
    how to auto open demo and create it in a new codesandbox
    TypeScript & Canvas 实现可视化白板
    2020~2021 职业规划书
    PostCSS All In One
    zsh terminal set infinity scroll height
    npm version ^ meaning
    vue-cli & webpack & vue.config.js
    [HDOJ5350]MZL's munhaff function
    [POJ3061]Subsequence
  • 原文地址:https://www.cnblogs.com/ccguo/p/3461134.html
Copyright © 2020-2023  润新知