Sunday March 03, 2013

"Use Autolayout Only When You Need To"

Joe Conway on autolayout tips:

Because of the way linear objective functions are evaluated, there isn’t an order that the constraints are computed in. So if that was how you were approaching constraints, get that out of your head: an equation like view.top = anotherView.bottom + 10 doesn’t mean that you find the value of anotherView’s bottom first and add 10 to get view’s top. It is just one more equation that has to be satisfied for your layout to work; both of these variables can change depending on the other constraints.

Great tips. Helped me wrap my mind around autolayout a bit more. Although, it’s still easier for me to think in terms of autoresizing masks. :-/