User Tools

Site Tools



An advanced system of organizing views on controllers. Useful for designing views that display correctly for multiple device sizes.

Relies on constraints which force objects' properties (x, y, width, height, etc) into certain ranges. Constraints can tie any of the given properties to another object, allowing a developer to make relative layouts instead of fixed ones.

Examples of constraint usage:

  1. place UILabel's left border at the right edge of this UIImage
  2. put UIButton less than 100 pixels below UILabel, but more than 20
  3. lock the height of UIImage to half its superview

Autolayout becomes painful when dozens of constraints jostle in a view. Autolayout attempts to place items by solving all the constraints in an equation; bugs are not immediately apparent.

Use when needed, avoid if possible: steep learning curve.

ios-labs-s14/advanced-autolayout.txt · Last modified: 2014/02/23 23:06 by mbarboi