通常,UIDocumentPicker 的行为是您呈现,然后用户必须使用右上角的“位置”菜单在服务之间切换。是否可以默认先显示“Dropbox”或“Google Drive”?几乎就像我们“深度链接”到 UIDocumentPicker 服务一样。
Slack 应用程序和 MyMail 应用程序似乎都可以做到这一点,但我无法找到它的 API。有任何想法吗?
不要使用 UIDocumentPickerViewController,而是尝试使用 UIDocumentMenuViewController。这里是相关文件 https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/AccessingDocuments/AccessingDocuments.html.
UIDocumentMenuViewController *documentProviderMenu =
[[UIDocumentMenuViewController alloc] initWithDocumentTypes:[self UTIs]
inMode:UIDocumentPickerModeImport];
documentProviderMenu.delegate = self;
[self presentViewController:documentProviderMenu animated:YES completion:nil];
默认情况下,这将显示包含文档提供程序扩展的应用程序(例如 Dropbox、Google Drive、iCloud 等)。因此,如果用户在其设备上安装了 Dropbox 或 Google Drive,这些选项将自动显示。
您还可以通过调用将自定义选项添加到菜单addOptionWithTitle:image:order:handler:
method.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)