Using UIStackView

At the top level, your new interface will have a vertical stack view with four elements displaying the item’s name, serial number, value, and date created (Figure 11.2).

Figure 11.2  Vertical stack view layout

Vertical stack view layout

Open your LootLogger project and then open Main.storyboard. Drag a new View Controller from the library onto the canvas. Drag a Vertical Stack View from the library onto the view for the View Controller. Add four constraints to the stack view: Pin it to the leading and trailing margins, then pin the top and bottom edges 8 points from the top and bottom of the safe area.

Now drag four instances of ...

Get iOS Programming: The Big Nerd Ranch Guide, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.