您的位置:首页 > 移动开发 > IOS开发

iOS 用其它应用打开文件研究&…

2014-01-23 17:32 453 查看
今天上班的状态还没有完全恢复,就拿Reminders里面的提醒来看看,研究一些以前没时间弄的东西,就发现了这个。


用其它应用打开文件研究 Open In..." TITLE="iOS 用其它应用打开文件研究 Open In..." />


这项功能开始不知道是哪个版本的iOS加入的,研究这些方法的时候才发现,原来从iOS3.2(iPad上市时)就开始支持了,真是惭愧啊。
下面慢慢道来

注册应用支持的文档类型(会被系统管理起来)

打开所用的ViewController

1.注册类型,按需要添加 附上本地的文档链接(搜索关键字:Uniform
Type Identifier Concepts)

(file:///Users/shjborage/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiOS5_0.iOSLibrary.docset/Contents/Resources/Documents/index.html#documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE)



用其它应用打开文件研究 Open In..." TITLE="iOS 用其它应用打开文件研究 Open In..." />


All
Files这个文件类型,是从Dropbox里面抄来的,你懂的(http://www.cocoanetics.com/2013/01/open-in-all-files/)。

2.打开文件ViewController 附本地文件链接:(搜索关键字:Previewing
and Opening Files)file:///Users/shjborage/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiOS5_0.iOSLibrary.docset/Contents/Resources/Documents/index.html#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html#//apple_ref/doc/uid/TP40010410-SW1



UIDocumentInteractionController

不知道的话看一下文档就好了,还是比较容易使用。



用其它应用打开文件研究 Open In..." TITLE="iOS 用其它应用打开文件研究 Open In..." />


再有的话呢,就是HandleOpenUrl的用法了,这个相信大家都比较熟悉了,就不多说了。URL的内容是文件的路径,你自己想干什么都可以咯。

附Apple
Example:https://www.dropbox.com/sh/v5885mtshjwfoz6/5DxyHws3rJ
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: