Introduction

Auto Layout is a system that lets you lay out your app’s user interface by creating a mathematical description of the relationships between the elements. You define these relationships in terms of constraints either on individual elements, or between sets of elements. Using Auto Layout, you can create a dynamic and versatile interface that responds appropriately to changes in screen size, device orientation, and localization.

../Art/autolayout_2x.png

Auto Layout is built into Interface Builder in Xcode 5, and is available to apps targeted at either iOS and OS X. Auto Layout is enabled by default when you create a new project. If you have an existing project that doesn’t use Auto Layout, read “Adopting Auto Layout.”

The typical workflow for creating user interfaces starts by using Interface Builder to create, reposition, resize, and customize your views and controls. When you are satisfied with the positions and settings, you’re ready to start adding Auto Layout constraints so that your interface can react to changes in orientation, size, and localization.

At a Glance

Auto Layout in Xcode 5 provides powerful workflows for rapidly and easily creating and maintaining constraint-based layouts in OS X and iOS apps. With Xcode 5, you can:

Organization of This Document

Read the following chapters to learn how to use Auto Layout: