One. Use of AutoLayout:
Mainly used for screen adaptation, especially after the iphone6,plus has occurred.
Two. How to use AutoLayout?
Click on the left one to see:
Click on the left two:
Basically want to AutoLayout, will be in these two buttons on the fuss.
Then do an exercise, such as:
The width is 100, and then centered, regardless of how the view is reversed, always centered
One. There are two constraints: width, height, center:
. The width and height are all 100:
2. Centered (view with respect to the simulator)
OK, you'll find a little reminder on the top left. Such as
There is a yellow dot, indicating that you set the constraints are right, but you set the constraints of the object does not have the correct frame, but Xcode for us to do a little, click on the yellow dot, the default is update frame, click Fix, Yellow disappears, you are done,
You may also find that there is a red dot, which may be a constraint is not enough, or a constraint conflict. Need to check constraints, generally, it is best to click below, the fastest check constraints.
The red area is the constraint, right click, click Delete, you can delete the constraint,
Some simple introduction to iOS AutoLayout and how to use it