UIKonf 2017 – Day 2 – Mischa Hildebrand – Auto Layout: From Trailing to Leading

Описание к видео UIKonf 2017 – Day 2 – Mischa Hildebrand – Auto Layout: From Trailing to Leading

"The tiny blue lines in Interface Builder look pretty self-explanatory: You can use them to define spacings between your views, give them a fixed width or a particular aspect ratio. But soon after creating your first simple layouts some of the blue lines turn red, indicating a conflicting layout. The more constraints you add the more pain it is to find the underlying problem. And it gets even worse when creating constraints in code or mixing Auto Layout with manual frame positioning.

Soon enough you'll find yourself digging through the Apple docs, trying out every method that sounds like it could solve your layout problem: setNeedsLayout(), layoutIfNeeded(), layoutSubviews(), setNeedsUpdateConstraints(), updateConstraintsIfNeeded(), updateConstraints(), setNeedsDisplay()... just to name a few of them. They all sound kind of similar. Some work in one case but not in the other. You never know why. It's like a magic black box.

The only way to dismantle this ""magic"" is to develop a deep understanding of the layout process, including the mathematics that's hidden behind the blue lines. This talk will give you the insight you need to effectively create beautiful layouts. You'll discover that constraints are linear equations by their true nature. You'll learn how the system resolves these equations to compute the actual frames and what the intrinsic content size is all about. You'll understand what constraint priorities are good for and how you can use them to make your layouts non-ambiguous.

Despite dealing with the very foundation of Auto Layout you won't be confronted with much code in this talk. It includes many animated visuals to let you develop a good intuition for the layout engine."

Комментарии

Информация по комментариям в разработке