Use stack views to lay out the views of your interface automatically. Use Auto Layout when you require precise placement of your views.
Framework
- UIKit
Overview
When you design your app’s interface, you position views and other interface elements in your app’s windows and size them appropriately. However, the size and position of those views may need to change at runtime for a variety of reasons:
The user can resize the window containing your views.
Variations in the screen sizes of iOS devices (including differences between portrait and landscape orientations) require different layouts for each device and orientation.
Apps on iPad must adapt to cover different amounts of screen space, ranging from a third of the screen to the entire screen.
Language changes might require size changes for labels and other text-based views.
Dynamic Type allows changes to the size of the text, which affects the size of the view.
UIStack
objects adjust the position of their contained views automatically when interface dimensions change. Alternatively, Auto Layout constraints let you specify the rules that determine the size and position of the views in your interface.