Reposted from: liubo0_0 column link URL: http://blog.csdn.net/liubo0_0/article/details/7085935
In UIView, there is an autoresizingMask attribute, which corresponds to an enumerated value (as follows). The attribute means to automatically adjust the position between the child control and the parent control, with a width and height.
Enum {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 <0,
UIViewAutoresizingFlexibleWidth = 1 <1,
UIViewAutoresizingFlexibleRightMargin = 1 <2,
UIViewAutoresizingFlexibleTopMargin = 1 <3,
UIViewAutoresizingFlexibleHeight = 1 <4,
UIViewAutoresizingFlexibleBottomMargin = 1 <5
};
Typedef NSUInteger UIViewAutoresizing;
The above meanings are explained separately.
UIViewAutoresizingNone is not automatically adjusted.
UIViewAutoresizingFlexibleLeftMargin is used to automatically adjust the distance from the left side of the superView, that is, the distance from the right side of the superView remains unchanged.
UIViewAutoresizingFlexibleRightMargin automatically adjusts the right distance from the superView, that is, the distance from the left side of the superView remains unchanged.
UIViewAutoresizingFlexibleTopMargin
UIViewAutoresizingFlexibleBottomMargin
UIViewAutoresizingFlexibleWidth
UIViewAutoresizingFlexibleHeight
The above will not be explained. Refer to the above.
You can also set multiple enumerations at the same time. As follows:
SubView. autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
If there are multiple, associate them with "|.
Another attribute is autoresizesSubviews. This attribute indicates whether subviews can be automatically adjusted. The default status is YES, which means YES. If it is set to NO, the autoresizingMask attribute of the subView is invalid.