Using Auto Layout in code

Auto Layout is a technique that can be used in Interface Builder as well as in code. You have created the contacts page entirely in Interface Builder, and that's very convenient. However, there are times when you might not be able to create the layout before the app runs. Let's call the moment of designing in Interface Builder the design time. At design time, it's possible that not all variables in your design are known. This means that you will need to dynamically add, remove, or update constraints when the app is running. When you do something while the app is running, you do it at runtime.

Setting up a layout visually with Auto Layout is very well supported, and Interface Builder even has some tools that make ...

Get Mastering iOS 12 Programming - Third 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.