我已经实现了一个文档选择器,并希望在浏览文档选择器时避免编辑文件和文件夹(例如重命名、复制、共享等选项)。任何人都可以帮助我,因为对于 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)
}