Create a large header from right to left on iOS 11

Starting with iOS 11, Apple added a large title display mode for UINavigationBar

and UINavigationItem

, which makes this effect:

enter image description here

We could just enable this effect by using the following Swift code:

navigationBar.prefersLargeTitles = true

      

My question is, how can we make a big title from right to left for use in east right to left languages?

Thanks in advance.

+3


source to share


2 answers


Well it should be automatic RTL for all RTL languages. All you have to do is set the device language as one of the RTL languages. Or if you are debugging this in a simulator, you can use the tools Xcode comes with a simulated RTL when you are actually using the LTR language



+1


source


I use this approach:



override func viewDidLoad() {
    super.viewDidLoad()

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

}

      

0


source







All Articles