The promisingly
yet misleadingly
-named Auto Layout

Springs and Struts

Auto Layout

a = mb + c

  • Size
  • Position
  • ==
  • >=
  • <=

Requirements

Get your demo on

Visual Format Strings

@"H:|-(20)-[imageView]-(20)-|"

@"H:|-(20@750)-[imageView(>=100@1000)]-(20@750)-|"

NSLayoutConstraint objects

[NSLayoutConstraint constraintWithItem:view1
                             attribute:NSLayoutAttributeBottom
                             relatedBy:NSLayoutRelationEqual
                                toItem:view2
                             attribute:NSLayoutAttributeBottom
                            multiplier:1.f
                              constant:0]
						

Remember...

The layout engine can't read your mind.

The layout engine can't evenly space multiple views.

Auto layout rewards a
methodical approach.

Auto layout does actually make sense.

Auto layout isn't required.

Resources