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 ...

Get iOS Auto Layout Demystified, Second Edition 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.