O'Reilly logo

iOS 8 SDK Development, 2nd Edition by Janie Clayton, Chris Adamson

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

Autolayout

In iOS, our UI elements are placed onscreen with an autolayout system that lets you determine where objects should go and how big they should be based on constraints that we set on them. This allows our interfaces to adapt to being rotated between portrait and landscape, and to handle the differing screen sizes of the 3.5-inch models (original iPhone through iPhone 4s), 4-inch models (iPhone 5, 5c, and 5s), the 4.7-inch iPhone 6, and 5.5-inch iPhone 6 Plus. Constraints allow us to express what matters to us—the size of components, their alignment with or distance from other components, etc.—and to let other factors vary as needed. In this example, we want our label and button to be horizontally centered, and we don’t care what the ...

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