问题
In my application upload the file from iclouds derive. want to upload xlsx, docx, txt.
want to upload the xlsx file means from iclouds derive want to display only xlsx another files should not display.[docx,txt]
same if the user want to display docx file means xlsx and txt ,xlsx file should not be display.
Here my code
@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
}
}
from iclouds derive all files are diplaying in recently added list. want to display only particular file in the list. how to achive help me. Thank advance
回答1:
Just adjust the documentTypes:
argument when creating your document picker.
documentTypes: ["org.openxmlformats.wordprocessingml.document"]
will let the user only select docx files.
documentTypes: ["org.openxmlformats.spreadsheetml.sheet"]
will let the user only select xlsx files.
来源:https://stackoverflow.com/questions/52777175/how-to-show-particular-file-format-from-iclouds-derive-in-ios-swift