The promisinglyyet misleadingly-named Auto Layout – Visual Format Strings – NSLayoutConstraint objects



The promisinglyyet misleadingly-named Auto Layout – Visual Format Strings – NSLayoutConstraint objects

0 0


autolayoutdemo

Presentation and demo for a light overview of auto layout during lunchtime at work.

On Github marramgrass / autolayoutdemo

The promisinglyyet 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 amethodical approach.

Auto layout does actually make sense.

Auto layout isn't required.

Resources