gpt4 book ai didi

iphone - UIDocumentInteractionController : open file whith native application

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:48:38 26 4
gpt4 key购买 nike

文档说 UIDocumentInteractionController 允许使用已安装的应用程序隐式打开文件(UTI 属性为 nil),但不是 native 的。

UIDocumentInteractionController *controller = [UIDocumentInteractionController  interactionControllerWithURL:fileURL];
[controller retain];
controller.delegate = self;
//controller.UTI = uti;

CDVViewController* cont = (CDVViewController*)[ super viewController ];
CGRect rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
[controller presentOpenInMenuFromRect:rect inView:cont.view animated:YES];

是否可以在 Safari 中打开 pdf 文件或在图库中打开图像?

附言我是 Objective C 的新手 :)

最佳答案

不可能告诉设备什么应用程序必须打开您的文件。

你可以使用 UIApplication's OpenUrl method例如打电话,或者用一些 url 启动 Safari ..例如:

[[UIApplication sharedApplication] openURL:@"tel://%i", someNumber];

但是如果你想打开一个特定的文件,你必须使用 UIDocumentInteractionController

还有QLPreviewController用于预览文档的 API。 <强> Here 是如何使用它以及查看它的外观的教程。

关于iphone - UIDocumentInteractionController : open file whith native application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15808536/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com