Ios UIDocumentPickerViewController正在以阿拉伯语显示翻转的内容
这是我打开文档选择器的方式Ios UIDocumentPickerViewController正在以阿拉伯语显示翻转的内容,ios,swift,cocoa-touch,uidocumentpickerviewcontroller,Ios,Swift,Cocoa Touch,Uidocumentpickerviewcontroller,这是我打开文档选择器的方式 func openDocuments(){ let documentPicker = UIDocumentPickerViewController(documentTypes: ["public.data"],in: .import) documentPicker.delegate = self documentPicker.modalPresentationStyle = .fullScreen se
func openDocuments(){
let documentPicker = UIDocumentPickerViewController(documentTypes: ["public.data"],in: .import)
documentPicker.delegate = self
documentPicker.modalPresentationStyle = .fullScreen
self.present(documentPicker, animated: true) {
}
}
注意单元格是如何翻转标签的
附言:
我有
UIView.appearance().semanticContentAttribute = .forceRightToLeft
因为我正在开发的应用程序只使用阿拉伯语一个简单的
documentPicker.view.semanticContentAttribute = .forceLeftToRight
修正了这个问题,但我还是觉得很奇怪。一个简单的例子
documentPicker.view.semanticContentAttribute = .forceLeftToRight
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)], in: .import)
documentPicker.delegate = self
documentPicker.view.semanticContentAttribute = .forceLeftToRight
documentPicker.allowsMultipleSelection = true
self.present(documentPicker, animated: true)
修复了这个问题,但我仍然觉得很奇怪。据我所知,将强制语义应用于
UIView.appearance()
会将其应用于所有视图,因此需要将其应用于各个视图。我没有开发或本地化具有从右到左语义的语言的经验,但如果用户使用阿拉伯语作为设备语言,用户的设备不应该自动管理这些语言吗?据我所知,使用UIView.appearance()应用强制语义将其应用于所有视图,因此,您需要在必要时将其应用于各个视图。我没有开发或本地化具有从右到左语义的语言的经验,但是如果用户使用阿拉伯语作为设备语言,用户的设备不应该自动管理这些语言吗?欢迎使用堆栈溢出,尽管这可能会回答这个问题,最好给出解释,而不仅仅是答案的代码。欢迎使用堆栈溢出,虽然这可能会回答问题,但最好给出解释,而不仅仅是答案的代码。
let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)], in: .import)
documentPicker.delegate = self
documentPicker.view.semanticContentAttribute = .forceLeftToRight
documentPicker.allowsMultipleSelection = true
self.present(documentPicker, animated: true)