如何使用“打开...” iOS应用程序的功能? [英] How to use "open in..." feature to iOS app?

查看:93
本文介绍了如何使用“打开...” iOS应用程序的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不打算将我的应用添加到打开...列表中,但是要获取列表本身。并将文件发送到另一个应用程序。

I'm not looking to add my app to the "open in..." list, but to get the list itself. And sending the file to another app.

我正在开发内部通信应用程序,因此当用户收到文件附件时,他/她可以使用任何应用程序打开该文件安装在每个设备上......

I'm working on internal communication app, so when user receive a file attachment, s/he can open the file with whatever app is installed on each devices...

推荐答案

UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:appFile]];
        self.controller.delegate = self;
CGRect navRect = self.view.frame;
[self.controller presentOptionsMenuFromRect:navRect inView:self.view animated:YES];

实施以下 UIDocumentInteractionControllerDelegate 方法

#pragma mark - UIDocumentInteractionControllerDelegate

//===================================================================
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return self;
}

- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
    return self.view;
}

- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
    return self.view.frame;
}

这篇关于如何使用“打开...” iOS应用程序的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆