【问题标题】:Multiple selection for document picker controller文档选择器控制器的多项选择
【发布时间】:2019-10-18 08:19:18
【问题描述】:

我正在尝试在文档选择器中选择多个文件。这是我的代码:

let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypeFolder)], in: .import)
documentPicker.delegate = self
self.present(documentPicker, animated: false) {
    if #available(iOS 11.0, *) {
        documentPicker.allowsMultipleSelection = true
    }
}

但它一次只选择一个文件。谁能给我一个正确的方法?

任何帮助将不胜感激!

【问题讨论】:

    标签: ios swift multipleselection uidocumentpickerviewcontroller


    【解决方案1】:

    先做吧

    self.present

    你的代码应该是

     let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypeFolder)], in: .import)
            documentPicker.delegate = self
            if #available(iOS 11.0, *) {
                 documentPicker.allowsMultipleSelection = true
             }
            self.present(documentPicker, animated: false) {
    
            }
    

    并在浏览选项卡中检查,而不是在 Recenets 选项卡中检查

    【讨论】:

    • 它只进入文件夹,并且选择器不会在点击完成按钮时被关闭。
    • 是的,您需要在完成选择后点击打开。完成按钮刚刚完成选择。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-20
    • 2018-08-16
    • 2018-02-04
    • 2012-10-02
    • 1970-01-01
    相关资源
    最近更新 更多