如何使用UIDocumentPickerViewController一次导入多个文件?

道格·理查森(Doug Richardson)

是否可以使用UIDocumentPickerViewController允许用户选择多个文件以从另一个应用程序导入?

阿南德·科雷(Anand Kore)

使用以下代码片段,这将在标题旁边添加“选择”按钮,以一次选择多个文件并将其导入。

UIDocumentPickerViewController *dvc = [[UIDocumentPickerViewController alloc]initWithDocumentTypes:arrContents inMode:UIDocumentPickerModeImport];
        dvc.delegate = self;
        [self presentViewController:dvc animated:true completion:^{
            if (@available(iOS 11.0, *)) {
                    dvc.allowsMultipleSelection = true;
            }
        }];

- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls

获取所选文件的列表。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章