
Элементы управления на снимке экрана встроены в UIStackView, который встроен в UICollectionView.
Мы уже кое-что сделали для поддержки нескольких языков, например:
Код: Выделить всё
// Switch to specific language
UserDefaults.standard.setValue(["ar"], forKey: "AppleLanguages")
// Force LTR or RTL
let langDirection = Locale.characterDirection(forLanguage: langId)
if langDirection == .rightToLeft {
UIView.appearance().semanticContentAttribute = .forceRightToLeft
UILabel.appearance().semanticContentAttribute = .forceRightToLeft
UITextField.appearance().semanticContentAttribute = .forceRightToLeft
UITextView.appearance().semanticContentAttribute = .forceRightToLeft
UINavigationBar.appearance().semanticContentAttribute = .forceRightToLeft
UIButton.appearance().semanticContentAttribute = .forceRightToLeft
UIScrollView.appearance().semanticContentAttribute = .forceRightToLeft
UITableView.appearance().semanticContentAttribute = .forceRightToLeft
UICollectionView.appearance().semanticContentAttribute = .forceRightToLeft
} else {
UIView.appearance().semanticContentAttribute = .forceLeftToRight
UILabel.appearance().semanticContentAttribute = .forceLeftToRight
UITextField.appearance().semanticContentAttribute = .forceLeftToRight
UITextView.appearance().semanticContentAttribute = .forceLeftToRight
UINavigationBar.appearance().semanticContentAttribute = .forceLeftToRight
UIButton.appearance().semanticContentAttribute = .forceLeftToRight
UIScrollView.appearance().semanticContentAttribute = .forceLeftToRight
UITableView.appearance().semanticContentAttribute = .forceLeftToRight
UICollectionView.appearance().semanticContentAttribute = .forceLeftToRight
}
// After language switched, rebuild UITabBarController and its viewControllers
// Auto Layout's leftAnchor / rightAnchor has been changed to leadingAnchor / trailingAnchor
Подробнее здесь: https://stackoverflow.com/questions/790 ... s-are-flip