© Wallace Wang 2019
Wallace WangBeginning iPhone Development with Swift 5https://doi.org/10.1007/978-1-4842-4865-2_13

13. Constraints and Stack Views

Wallace Wang1 
(1)
San Diego, CA, USA
 

Since the iPhone and iPad come in different screen sizes, every iOS app needs to adapt to these different screen sizes depending on the type of iOS device it’s running on. To define the position and spacing of different user interface objects, you can use constraints.

Constraints can define the following:
  • Position (such as the center of the screen)

  • Size (such as the width or height of an object)

  • Distance (such as the space between two objects)

Without constraints, objects on the user interface might look good on one size iOS screen but look completely skewered on another ...

Get Beginning iPhone Development with Swift 5: Exploring the iOS SDK 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.