Autolayout code implementation example-02-use VFL
0. Introduction: VFL stands for visual format language, which can abstract the layout of one or more views. VFL is simpler than autolayout using linear formulas.
1. Example 1
Requirement: create two views, one in blue and one in red. The distance between blue and the top, left, and right of the screen is 20, make the spacing between the top of the red view and the bottom of the Blue View 20, and the right edge of the two is aligned.
Result: Landscape screen:
2. Example 2
Requirement: create two views, one in blue and one in red. The requirement is that the blue and red views stick to the bottom of the screen forever. The distance between the left and bottom of the Blue View is 20, the width and height of the red view are the same and arranged in the same row.
Result: Landscape screen:
Autolayout code implementation example-02-use VFL