About Auto Layout and Layout Constraints
Use Auto Layout to define relationship constraints for your app’s user interface so that when one object changes its size or position, that object and its neighboring objects adjust their sizes and positions appropriately. For example, you can center an image horizontally in a storyboard scene. As the user rotates the iOS device, the image remains horizontally centered in both landscape and portrait orientations of the device.
With Auto Layout constraints governing the layout, the objects in your user interface automatically resize and reposition themselves whenever:
The user changes the screen orientation of an iOS device.
The user resizes a window in a Mac app.
Content dimensions change (for example, when the length of a text string changes in a label or button).
To add layout constraints, you commonly Control-drag between two objects. Interface Builder presents you with a list of appropriate constraints. Choose constraints from this list, as shown in the following screenshot. (Alternative methods for adding layout constraints are described in the Related Articles below.)
Constraints are represented on the canvas by solid blue lines. If you double-click a constraint on the canvas, a pop-up window lets you view and edit the properties of that constraint.
When you create a project, Auto Layout is enabled by default. If you need to disable Auto Layout, choose View > Utilities > Show File Inspector and deselect the checkbox for “Use Auto Layout.”