Use of Masonry

Source: Internet
Author: User

1.//Add this macro, you do not have to take the Mas_ prefix

#define Mas_shorthand

Add this macro, Equalto is equal to Mas_equalto

#define Mas_shoryhand_globals

This header file must be placed behind the top two macros

#import "Masonry.h"

[_label1mas_makeconstraints: ^ (masconstraintmaker *make) {    

Make. top. Equalto(_contentview1. Mas_top). with. Offset(ten);

Make. left. Equalto(_contentview1. Mas_left). with. Offset(5);

Make. height. Equalto(@50);

}];

[_label2 mas_makeconstraints: ^ (masconstraintmaker *make) {

Make. left. Equalto(_label1. Mas_right). with. Offset(5);

Make. top. Equalto(_contentview1. Mas_top). with. Offset(ten);

// the right interval remains greater than or equal to 5

Make. right. Lessthanorequalto(_contentview1. Mas_right). with. Offset( -5);

Make. height. Equalto(@50);

}];

2.Masequalto and Equalto differences: masequalto more than Equalto type conversion operations, generally speaking, most of the time two methods are common, but for numeric elements use Mas_equalto.

For the handling of objects or multiple properties, use Equalto. In particular, multiple attributes must be used Equalto, such as Make.left.and.right.equalTo (Self.view);

3.setcontenthuggingpriority Understanding as constraint precedence

Setcontentcompressionresistancepriority understood as content priority

These two are set the priority between content and constraints, if the constraint is high priority, when the view is not enough, the content will be compressed, and conversely, constrained compression

Use of Masonry

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.