在我的应用程序中,上传来自iclouds派生的文件。想上传xlsx,docx,txt。
要上传xlsx文件意味着从iclouds派生只显示xlsx其他文件不应该display.docx,txt
同样,如果用户希望显示docx文件意味着xlsx和txt,则不应该显示xlsx文件。
这是我的代码
@IBAction func moveiclouds_BtnClick(_ sender: Any) {
let documentPicker = UIDocumentPickerViewController(documentTypes: [kUTTypePDF as String, "com.microsoft.word.doc", "com.microsoft.excel.xls", kUTTypeCompositeContent as String, kUTTypeJPEG as String], in: .import)
documentPicker.delegate = self
self.present(documentPicker, animated: true, completion: nil)
}
extension CreateFeesView: UIDocumentPickerDelegate{
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
let cico = url as URL
cico_files = cico
filepath_fees = url.pathExtension
}
}
从iclouds派生所有文件在最近添加的列表中显示。希望只显示列表中的特定文件。怎样才能帮助我。谢恩
发布于 2018-10-18 12:17:47
创建文档选择器时,只需调整documentTypes:
参数即可。
documentTypes: ["org.openxmlformats.wordprocessingml.document"]
只允许用户选择docx文件。
documentTypes: ["org.openxmlformats.spreadsheetml.sheet"]
只允许用户选择xlsx文件。
https://stackoverflow.com/questions/52777175
复制相似问题