繁体   English   中英

如何显示iclouds中的特定文件格式源自iOS Swift

[英]How to show particular file format from iclouds derive in ios swift

在我的应用程序中,从iclouds导出文件。 想要上传xlsx,docx,txt。

想要上传xlsx文件意味着从iclouds派生出只希望显示xlsx而不显示其他文件。[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的所有文件都在最近添加的列表中显示。 希望仅在列表中显示特定文件。 如何达到帮助我。 谢谢提前

创建文档选择器时只需调整documentTypes:参数即可。

documentTypes: ["org.openxmlformats.wordprocessingml.document"]

将只允许用户选择docx文件。

documentTypes: ["org.openxmlformats.spreadsheetml.sheet"]

将只允许用户选择xlsx文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM