AutoresizingMask attribute of UIView, autoresizingmask

Source: Internet
Author: User

AutoresizingMask attribute of UIView, autoresizingmask

When I made the album list today, I found that some UITableViewController attributes were hard to remember and I found some materials. Make a backup.

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};

UIViewAutoresizingNone is not automatically adjusted, and the coordinate value of the control relative to the parent view remains unchanged.
UIViewAutoresizingFlexibleLeftMargin automatically adjusts the distance from the left side of superView to ensure that the distance from the right side of superView remains unchanged.
UIViewAutoresizingFlexibleRightMargin automatically adjusts the right distance from the superView to ensure that the left distance from the superView remains unchanged.
UIViewAutoresizingFlexibleTopMargin automatically adjusts the distance from the superView top to ensure that the distance from the superView bottom remains unchanged.
UIViewAutoresizingFlexibleBottomMargin automatically adjusts the distance from the superView bottom, that is, the distance from the superView top remains unchanged.
UIViewAutoresizingFlexibleWidth automatically adjusts its width to ensure that the distance from the left and right of the superView remains unchanged. 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 automatically adjusts its height to ensure the distance from the top and bottom of the superView.


UIViewAutoresizingFlexibleLeftMargin.

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)];

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

 

Other combinations are similar.

 

 

 

 

 

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

Related Article

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.