4

As of iOS 11, Apple has added Large Title Display Mode for UINavigationBar and UINavigationItem which makes an effect like this:

enter image description here

We could simply turn this effect on using the following Swift code:

navigationBar.prefersLargeTitles = true

My question is how we can make the large title right to left to be usable for Eastern right to left languages?

Thanks in advance.

4

2 回答 2

8

我使用这种方法:

override func viewDidLoad() {
    super.viewDidLoad()

    navigationController?.navigationBar.subviews[1].semanticContentAttribute = .forceRightToLeft

}
于 2017-11-21T08:10:40.690 回答
2

好吧,它应该是所有 RTL 语言的自动 RTL。您所要做的就是将设备语言设置为 RTL 语言之一。或者,如果您在模拟器中进行调试,您可以使用 Xcode 随附的仪器来模拟 RTL,而您实际上正在使用 LTR 语言

于 2017-06-22T11:42:23.370 回答