OS X Lion introduced a new layout system for Cocoa, replacing the historical springs and struts model. iOS 6 adopts this system.
Autolayout is a constraint-based layout engine that can handle an amazing variety of user interfaces.
Yesterday, I reviewed CS193p Lecture 8 and then took about 5 minutes to make my Card Playing View all nice in Autolayout.
Prof Hegarty isn’t kidding when he calls it whack-a-mole system since changing one constraint introduces another item to review in a chain of constraints. But it is a speedy way nonetheless to get something working for an iPhone 4 or 5 or iPad Retina or mini.
If you’d like further information on Auto Layout there are the following three great WWDC 2012 Sessions (that’s close to 3 hours of Auto Layout):
- Session 202: Introduction to Auto Layout for iOS and OS X: Come on in, the water’s fine!
- Session 228: Best Practices for Mastering Autolayout for OS X and iOS
- Session 232: Autolayout By Example
Also, Ben Scheirman’s NSScreencast Episode #35, is a great, quick, 13 minute tour of Autolayout for subscribers.