Changing Label Constraints

The app is now shown in German, but there is still one issue. To see this, run the app on the simulator and rotate to landscape. As you can see in Figure 5-10, the translated Total Cars label is too long.

Image

Figure 5-10 Translated label drawn outside of the container view

The core problem is the translated string is too large to fit on one line in the space provided by the add car group. Normally, you would expect to see a truncated string with a continuation character, something like “Anzahl aller Au...”.

The reason is the width of the label is not constrained to the width of its container. The resulting frame extends ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.