как удалить semanticContentAttribute при представлении контроллера представления - PullRequest
1 голос
/ 30 марта 2020

Мое приложение поддерживает языки Engli sh и Arabi c. Я использую свойство UIView.appearance (). SemanticContentAttribute для переключения между RTL на LTR и наоборот, как показано ниже.

 if selectedLanguageId == "eng"{
     UIView.appearance().semanticContentAttribute = .forceLeftToRight
 }else{
     UIView.appearance().semanticContentAttribute = .forceRightToLef
 }

Я представляю событие календаря EKEventEditViewController () с использованием self.present (eventController, animated: true) , завершение: ноль). Я хотел показать этот экран всегда LTR.

Я пробовал использовать следующий код, но он отображается как RTL, когда я меняю язык на арабский c.

let eventController = EKEventEditViewController()
eventController.editViewDelegate = self
eventController.event = event
eventController.eventStore = self.eventStore
eventController.view.semanticContentAttribute = .forceLeftToRight
self.present(eventController, animated: true, completion: nil)

Пожалуйста, помогите мне представить это представление всегда LTR.

wi

1 Ответ

2 голосов
/ 30 марта 2020

Do

UIView.appearance().semanticContentAttribute = .forceRightToLeft
self.present(eventController, animated: true, completion: nil)

, а когда вы увольняетесь, сделайте

if selectedLanguageId == "eng"{
   UIView.appearance().semanticContentAttribute = .forceLeftToRight
 }else{
  UIView.appearance().semanticContentAttribute = .forceRightToLeft
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...