What is AutoLayout (auto layout, relative layout)? In my superficial understanding, AutoLayout is a tool for describing the relationship between a view (control) and a view;
Of course, this relationship includes a child view and a child view (such as a two button on a view), a relationship between the child view and the parent view (such as a button distance from the right edge of his parent view), a size relationship (such as higher width), a boundary distance relationship, a center point (CenterX and CenterY) relationships also have proportional scaling (ratio) relationships;
The principle of AutoLayout is actually based on the mathematical solution of the first equation, the final calculation of the constraint value; According to this, if you give a group of equations, can produce different results, storyboard will not be able to calculate the only correct constraint results; For example, you add two constraints that create a conflict (For example, a button is 20 away from the left side of the parent view, and a constraint on the center of the CenterX and parent view is added to the conflict); So the constraints we give must be non-conflicting (as long as there is no conflict, the repetitive constraints are possible, For example, you write an equation in the middle of a group of equations, and the result is not changed.
Example of AutoLayout principle: Four buttons on the view, the distance boundary is 0, and equal width, then we can list an equation 4 X = screenwidth; So we can solve the width of each button.
The above description, there may be some abstraction, I will be in the subsequent tutorials with the pieces and code, so that you can more specific understanding of AutoLayout
Summarize the principles of Use of AutoLayout: 1. The constraint that is added must be able to determine the position and size of a view of 2. The constraints that are added must be calculated, and can uniquely derive a width or boundary value of 3. The constraint that you add must be non-conflicting, or it will cause a crash (can repeat) 4. The constraints that are added to the default on storyboard are the constraints between adjacent nearest views 5. The constraint that is added may not be convenient for animating the constraint on the view 6. The added constraint is preferably added as a reference to a view, which facilitates modification, reaching
7.autolaout can be mixed with frame absolute layout
IOS AutoLayout Automatic Layout Intermediate Development tutorial (1)-talking about AutoLayout