tezvyn:

How does Auto Layout resolve constraints?

Source: interviewadvanced

WHAT IT TESTS: understanding constraint-based layout. OUTLINE: Auto Layout solves a system of prioritized linear equations; intrinsicContentSize is a view's natural size; hugging resists growing, compression resistance resists shrinking.

WHAT IT TESTS: whether you understand Auto Layout as a constraint solver, not magic. ANSWER OUTLINE: the engine treats constraints as prioritized linear equations and inequalities and finds a satisfying solution, with required constraints at priority 1000 and lower priorities broken when needed; intrinsicContentSize is the natural size a view wants based on its content; content hugging priority resists growing larger than that size, while compression resistance priority resists shrinking smaller.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

How does Auto Layout resolve constraints? · Tezvyn