Forget about frames, forget about multiple nibs for each view controller. Autolayouts are here to solve complex relations between UI objects and make a robust UI that will hopefully require less maintenance with the introduction of new device form factors.
Autolayouts first appeared in iOS 6 and XCode 4.6. They constituted a big change in interface design. A complex set of rules was introduced for UI implementation. Let’s be honest, this was not a good start since Interface Builder at the beginning was trying to be smarter than the developer and was modifying the designs in an often unwanted way.
The programatically applied interfaces have been introduced as the alternative to IB, but the NSLayoutConstraint’s lengthy method constraintWithItem: scares many programmers and the ASCIIart from constraintsWithVisualFormat: gives a headache at the first glance.
The issues with IB are pretty much in the past. It’s now way easier to create desired constraints and debug them in the XCode 5.0+. Open source programmers have not been lagging behind and we can now find libraries helping with the interface design in code.
During my daily work I can see that the Autolayout is being more and more used in the interface design, but when it comes to dynamic changes in the interface (and animations in particular) many programmers revert to the “comfort zone” of pixels and frames. All that can obviously be done using autolayouts, easier than you might have thought.
I’ll show how to create layouts that adjust to both iPhone and iPad design and respond adequately to the changing content.
I’ll present how to interpret and fix warnings and errors that are presented in the Interface Builder. I’ll show when and how to create and manipulate autolayout constraints in code and create fun animations.
I’ll introduce the Lyt library (github.com/robotmedia/Lyt).
As an addition I’ll also introduce the NibWrapper library for modular interface design that plays very well with Autolayouts (github.com/mobilejazz/NibWrapper).