Content hugging and content Compression for IOS AutoLayout resistance

Source: Internet
Author: User

Content hugging and content Compression resistance

These two properties are important for controls that have intrinsic content size (for example, Button,label). In layman's terms, a control with intrinsic content size knows (can calculate) its own size, such as a label, and when you set Text,font, its size can be calculated. About the intrinsic content size official explanation:

Hugging priority determines how large the view has to prevent itself from getting bigger.

Compression resistance priority determines how much precedence prevents you from getting smaller.

Hugging priority determines how large the view has to prevent itself from getting bigger.

Compression resistance priority determines how much precedence prevents you from getting smaller.

Very abstract, in fact content hugging is to maintain the current view in its optimal size (intrinsic content size), you can imagine to add an extra width to view constraint , this constraint tries to keep the size of the view from getting bigger :

View.width <= Optimal size

The priority of this constraint is obtained and set by the method above, and content hugging defaults to 250.

Content Compression Resistance is to maintain the current view in his optimal size (intrinsic Content size), which can be imagined as adding an extra width to the view Constraint, this constraint tries to keep the size of the view from getting smaller :
View.width >= Optimal size
This default priority is 750.

Content hugging and content Compression for IOS AutoLayout resistance

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.