zoukankan      html  css  js  c++  java
  • 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];

            

        }

        

    }

  • 相关阅读:
    jq validate的用法
    position:fixed定位
    postgresql-日志表
    postgresql-查看各个数据库大小
    postgresql-清空shared_buffers
    postgresql-int,bigint,numeric效率测试
    postgresql-查看表大小
    mongodb postgresql mysql jsonb对比
    postgresql和redis
    postgresql-死锁
  • 原文地址:https://www.cnblogs.com/ccguo/p/3461134.html
Copyright © 2011-2022 走看看