ios - Swift UIDocumentPickerViewController 不像操作表弹出窗口那样显示

标签 ios swift uidocumentpickerviewcontroller

我正在尝试访问第三方云应用程序。我的应用程序上传按钮单击打开 UIDocumentPickerViewController 并需要选择文件(单个或多个),然后我上传我的服务器。

  1. 上传按钮点击UIDocumentPickerViewController打开全屏而不是像操作表一样打开。

  2. 需要访问所有类型的文件。

下面是我的代码

let importMenu = UIDocumentPickerViewController(documentTypes: ["public.text", "com.apple.iwork.pages.pages", "public.data"], in: .import)
importMenu.delegate = self
importMenu.modalPresentationStyle = .formSheet            
if let popoverPresentationController = importMenu.popoverPresentationController {
    popoverPresentationController.sourceView = self.view;
    //popoverPresentationController.sourceView = sender as? UIView
    //popoverPresentationController.sourceRect = sender.bounds
}
self.present(importMenu, animated: true, completion: nil)  

最佳答案

检查文档,您的答案位于下图中。 enter image description here

关于ios - Swift UIDocumentPickerViewController 不像操作表弹出窗口那样显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51784013/

相关文章:

ios - 在 iOS 中显示保存文件文档选择器而不提供本地文件 URL

swift - UIDocumentPicker 导航栏按钮在 iOS 11 中被隐藏

ios - 切换 View 超音速

XCode 6.2 中缺少 iOS Simulator 8.1 SDK

iPhone - 设计我自己的 viewController 转换

ios - 打开通知中心会在导航栏上创建视觉错误

ios - 在以模态方式从 View Controller 切换到另一个 View Controller 后,在 View Controller 上添加模糊效果

iphone - NSDecimal 需要桥接

ios - 每个 UITableViewCell 都有自己的任务(Webservice 调用),并且应该在其任务完成时重新加载,该任务每 30 秒调用一次

ios - 如何在多个选择选项时限制为 UIDocumentPickerViewController 选择文件夹