Uiviewautoresizingnone = 0, uiviewautoresizingflexibleleftmargin = 1 <0,
Uiviewautoresizingflexiblewidth = 1 <1,
Uiviewautoresizingflexiblerightmargin = 1 <2,
Uiviewautoresizingflexibletopmargin = 1 <3,
Uiviewautoresizingflexibleheight = 1 <4,
Uiviewautoresizingflexiblebottommargin = 1 <5
After detailed tests, gaoyp finally verified the significance of these values and found that all the information found on the Internet was wrong. Once Khan, we copied each other and did not check it.
Because the horizontal and vertical transformations are the same, we take the more common vertical transformations in the iPhone as an example:
Uiviewautoresizingnone.
Uiviewautoresizingflexiblewidth: the width of the control changes proportionally with the width of the parent view;
For example, the label width is 100 and the screen width is 320. When the screen width is 480, the label width changes to 100*480/320
Uiviewautoresizingflexibleheight: Same as uiviewautoresizingflexiblewidth
Uiviewautoresizingflexibleleftmargin: the distance to the left of the screen changes proportionally with the width of the parent view;
For example: cgrectmake (50,100,200, 40)]; when the screen width is 320, X is 50; when the screen width is 480, the labelx coordinate is changed to 50*480/320. Control coordinates change to cgrectmake (75,100,200, 40)];
Uiviewautoresizingflexibletopmargin: The height remains unchanged. The top margin is flexible and the bottom margin remains unchanged.
Uiviewautoresizingflexibletopmargin | uiviewautoresizingflexibleheight:
The transformation of this combination is relatively round:
First, the bottom margin is unchanged, but the height and top margin change. The calculation of the transformation is as follows,
For example, the height of the superview is increased from 100 to 200. Your own bottom margin is 50,
Then, after removing the unchanged margin, the ratio of the superview changes is: (100-50)/(200-50) = 50/150 = 1/3.
Then, the top margin and height are three times higher.
Uiviewautoresizingflexibletopmargin | uiviewautoresizingflexibleheight | uiviewautoresizingflexiblebottommargin:
The calculation of this transformation is relatively simple, saving your own top margin, height, bottom margin and superview.
For example, the height of a superview changes from 100 to 200. Then the top margin, height, and bottom margin of the current user are also two times the original ones.
The preceding transform only occurs when autoresizessubviews of superview are yes. Autoresizessubviews is yes by default.
At the same time, the contentmode of superview does not affect the sub view transformation.
@ Property (nonatomic) bool autoresizessubviews; // default is yes. If set, subviews are
Adjusted according to their autoresizingmask if self. bounds changes