The Autoresizingmask property of UIView

Source: Internet
Author: User

Today when the album list, found some Uitableviewcontroller properties bad memory, and then looked for some information. Make a backup.

There is a Autoresizingmask property in UIView, which corresponds to the value of an enumeration (as follows), which means that the position of the child control and the parent control is automatically adjusted to a height of width.

enum{Uiviewautoresizingnone=0, Uiviewautoresizingflexibleleftmargin=1<<0, Uiviewautoresizingflexiblewidth=1<<1, Uiviewautoresizingflexiblerightmargin=1<<2, Uiviewautoresizingflexibletopmargin=1<<3, Uiviewautoresizingflexibleheight=1<<4, Uiviewautoresizingflexiblebottommargin=1<<5};

Uiviewautoresizingnone is not automatically adjusted, the control is not changed relative to the parent view coordinate value.
Uiviewautoresizingflexibleleftmargin automatically adjusts the distance to the left of the superview, ensuring that the distance to the right of the Superview is constant.
Uiviewautoresizingflexiblerightmargin automatically adjusts to the right distance from the Superview to ensure that the distance to the left of the Superview is constant.
The uiviewautoresizingflexibletopmargin automatically adjusts the distance from the top of the Superview to ensure that the distance from the bottom of the Superview is constant.
Uiviewautoresizingflexiblebottommargin automatically adjusts the distance from the bottom of the Superview, that is, the distance from the top of the Superview is constant.
Uiviewautoresizingflexiblewidth automatically adjusts its width to ensure that the distance to the left and right of the Superview is constant, and the width of the control changes proportionally with the width of the parent view.

For example: Label width is 100 and screen width is 320. When the screen width is 480, the label width changes to 100*480/320
Uiviewautoresizingflexibleheight automatically adjusts its height to ensure that the distance from the top and bottom of the Superview is constant.


Uiviewautoresizingflexibleleftmargin | Uiviewautoresizingflexiblerightmargin automatically adjusts the distance to the left of the superview to ensure that the distance to the left and to the right is the same as the distance from the left and right.

For example: CGRectMake (50, 100, 200, 40)]; When the width of the screen is 320,x 50;

When the screen width is 480, the LABELX coordinates become 50*480/320. Control coordinates change to CGRectMake (75, 100, 200, 40)];

The original distance is 20, 30, the adjusted distance should be 68,102, that is, 68/20=102/30.

Other combinations are similar.

This article was reproduced from: http://www.cnblogs.com/jiangyazhou/archive/2012/06/26/2563041.html

The Autoresizingmask property of UIView

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.