首页 > 解决方案 > 从 ios 中的文档选择器中选择文件时如何防止编辑文件(重命名、共享等)

问题描述

我已经实现了一个文档选择器,并希望在浏览文档选择器时避免编辑文件和文件夹(例如重命名、复制、共享等选项)。任何人都可以帮助我,因为对于 UIDocumentPickerViewController 没有类似的 allowEditing。

func documentPicker(from view: UIView) {
               let importMenu = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF),
       String(kUTTypeJPEG), String(kUTTypeGIF)], in: .import)
               importMenu.delegate = self
               importMenu.setEditing(false, animated: false)
               importMenu.modalPresentationStyle = .popover
               if let presentation = importMenu.popoverPresentationController {
                   presentation.permittedArrowDirections = .any
                   presentation.sourceView = view
                   presentation.sourceRect = view.bounds
                   }
                 parentController?.present(importMenu, animated: true, completion: nil)
           }

标签: iosswiftuidocumentpickerviewcontroller

解决方案


推荐阅读