iOS Auto Layout Demystified by Erica Sadun is an excellent book on Auto Layout.
From the preface:
You’ll explore many of the strengths of Auto Layout as well. It’s a technoloy that has a lot going for it:
- Auto Layout is declarative. You express the interface behavior without worrying about how those rules get implemented. Just describe the layout; let Auto Layout calculate the frame.
- Auto Layout is descriptive and relational. You describe how items relate to each other onscreen. Forget about sizes and positions. What matters is the relationships.
- Auto Layout is centralized. Whether in IB or a layout section in your own code, Auto Layout rules tend to migrate to a single nexus, making it easier to inspect and debug.
- Auto Layout is dynamic. Your interface updates as needed to respond to user- and application-sourced changes.
- Auto Layout is localizable. Conquer the world with Auto Layout. It’s built to adapt to varying word and phrase lengths while maintaining interface integrity.
- Auto Layout is expressive. You can describe many more relationships than you could in the older springs-and-struts system. Go beyond "hug this edge" or "resize along this axis" and express the way a view relates to other views, not just its superview.
- Auto Layout is incremental. Adopt it on your own timescale. Add it to just parts of your apps and parts of your interfaces, or jump in feet first for a full Auto Layout experience. Auto Layout offers backward compatibility, enabling you to build your interfaces using all springs-and-struts, all constraints, or a bit ob both.
What I love about Auto Layout is that the system is declarative: you just tell what you want and the system computes the frames for you, sometimes better than you could do by hand, see Cocoa Auto Layout Release Notes:
The benefits of this approach are most clear for localization and resolution independence. With this architecture, your localization effort is typically confined to translating strings. You don’t have to specify new layout, even for right-to-left languages such as Hebrew and Arabic (in which the left-to-right ordering of elements in the window should generally be reversed). For resolution independence, this system allows for pixel-perfect layout at nonintegral scale factors for interfaces designed in Interface Builder. Neither was previously possible.
Erica Sadun’s iOS Auto Layout Demystified does a very good job at explaining the system’s motivations and gives a lot of tips & tricks on Auto Layout. The second edition have been revised for iOS 7 and Xcode 5, and I’ve particularly appreciated the parts explaing Interface Builder.
If you’re looking for other Auto Layout pointers, the WWDC conferences are a good start:
- Introduction to Auto Layout for iOS and OS X - Session 202
- Auto Layout by Example - Session 232
- Best Practices for Mastering Auto Layout - Session 228
- Taking Control of Auto Layout in Xcode 5 - Session 406
- Interface Builder Core Concepts - Session 405
We don’t know what will be iOS in 5 years, but I bet we will have more resolutions and more screen forms factors. Auto Layout is designed to help you build interfaces, it’s the future, so adopt it.