O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Text Alignment

The last issue is the Car Info label’s text alignment. Although the text is shown right-to-left, the label itself uses left alignment. Things such as the Car Number label work because the label is just as big as it needs to be to show the text.

The car info area is larger than it needs to be and is left aligned, the default for all labels. Although the text direction is reversed, it still is aligned to the left, and the label is larger than just the size of the text.

There is no automatic way to correct for this. Auto layout has already updated the leading and trailing alignment of the label. You need to detect a right-to-left language and change the alignment of the car info view.

Add the code from Listing 5-6 to the viewWillAppear: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required