O'Reilly logo

Mastering iOS 10 Programming by Donny Wals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Easier layouts with UIStackView

With iOS9, Apple released an iOS version of OS X's NSStackView into UIKit. It's called UIStackView. This was huge news because this view makes stacked layouts a whole lot easier to create and maintain. The most common use case for a UIStackView is when you have a couple of views that are laid out relative to each other with equal spacing in between the items.

The layout we created earlier for the contact detail page can definitely benefit from using UIStackView. The list of labels that display a user's details is a list that can benefit a lot from being converted to a UIStackView. Currently, every label has a constraint to the label below. This means that adding or removing a label right in the middle would involve ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required