With the release of the iPhone SE and the iPad Pro, along with the expectation that iPad apps will include support for slide over and split screen mode it’s now clear that Auto Layout is here to stay. If you’re not already developing apps using Auto Layout and Size Classes now is a great time to learn more about them and prepare yourself for any updates to the APIs that Apple introduces at WWDC in June.
Fortunately there’s a lot of great resources to quickly get up to speed and learn the best way to support a variety of devices and size classes in your next app.
Apple has an excellent Auto Layout guide and a pair of videos from WWDC that explain how Auto Layout works and how to debug the set of constraints in the views of your app. Start with these, experiment with the frameworks and sample code, and then dig into the resources below.
- Auto Layout Guide
- WWDC 2015 – Mysteries of Auto Layout, Part 1
- WWDC 2015 – Mysteries of Auto Layout, Part 2
- UIScrollView and Auto Layout
Achieving Zen with Auto Layout
While Apple’s documentation is a great place to start, the most comprehensive resource I’ve found is Achieving Zen with Auto Layout by Justin Williams. The 2nd edition has been updated to include the latest information and covers everything from the history of the frameworks to animating and debugging constraints in your app. The $40 ebook and collection of sample code is essential.
Reveal – runtime view debugging
Xcode includes some visual debugging tools but they pale in comparison to Reveal by Australia’s Itty Bitty Apps. The Reveal framework is dead simple to integrate into your Xcode project and the UI is incredibly slick and easy to use. The ability to inspect and edit constraints live while your app is running is invaluable and alone is worth the price of a license. However, the app includes many other features unrelated to Auto Layout which make it an absolute must have tool for iOS and tvOS development and debugging. Version 1.6 is available now and I’ve heard that version 2.0 will include some awesome new features and changes.
Finally, the development community has written a number of great posts about Auto Layout and Size Classes. Here’s a few that I’ve bookmarked which I find myself turning back to again and again.
- How I Learned to Stop Worrying and Love Cocoa Auto Layout
- Auto Layout in iOS 8 – layoutDebuggingIdentifier
- A Size Class Reference Guide
- Auto Layout Breakpoints
- Inspecting Auto Layout with the Cocoa Layout Instrument
- Pain Free Constraints with Layout Anchors
(top image from apple.com)
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.