O'Reilly logo

iOS Auto Layout Demystified, Second Edition by Erica Sadun

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

A. Answers to Exercises

Chapter 1

1. A label is constrained with 8-point offsets from its superview’s leading and trailing edges. It is 22 points high. Is this label’s layout ambiguous? If so, how can you remove the ambiguity?

The layout is ambiguous. The label is missing a vertical position. Remove the ambiguity by setting a y position, such as by centering the label vertically in its superview or offsetting it a fixed amount from its superview’s top edge.

2. You create a system-style button and assign it the title Continue. The button’s center is constrained to a point (150, 150) from its superview’s top and leading edges. Is this view’s layout ambiguous? If so, how can you remove the ambiguity?

The layout is not ambiguous. The view’s height ...

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