1

这就是我打开文档选择器的方式

func openDocuments(){
        let documentPicker = UIDocumentPickerViewController(documentTypes: ["public.data"],in: .import)
        documentPicker.delegate = self
        documentPicker.modalPresentationStyle = .fullScreen

        self.present(documentPicker, animated: true) {
        }

    }

注意单元格如何翻转标签

在此处输入图像描述

PS:

我有

UIView.appearance().semanticContentAttribute = .forceRightToLeft

因为我正在开发的应用程序只有阿拉伯语

4

3 回答 3

1

在呈现前确保浏览器布局UIDocumentPickerViewController按照设备的布局方向根据语言UIDocumentPickerViewController

    if Locale.current.languageCode == "ar" {
        UIView.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).semanticContentAttribute = .forceRightToLeft
    } else {
        UIView.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).semanticContentAttribute = .forceLeftToRight
    }
于 2022-03-03T11:18:25.077 回答
0

一个简单的

documentPicker.view.semanticContentAttribute = .forceLeftToRight

解决了这个问题,但我仍然觉得它很奇怪。

于 2019-11-11T07:36:14.693 回答
0
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)], in: .import)
documentPicker.delegate = self
documentPicker.view.semanticContentAttribute = .forceLeftToRight
documentPicker.allowsMultipleSelection = true
self.present(documentPicker, animated: true)
于 2020-06-01T10:16:21.577 回答