Use of third-party framework masonry to implement layouts

Source: Internet
Author: User

1.

Https://github.com/SnapKit/Masonry

2. Use

Configuration of the 2.1 masonry

Only need to introduce the header file Masonry.h can be used;

Common methods of 2.2 masonry

Create a new constraint

[View mas_makeconstraints:^ (Masconstraintmaker *make) {}];

If a constraint is already in the past, the new constraint is updated, and if there is no constraint, the constraint is added

[View mas_updateconstraints:^ (Masconstraintmaker *make) {}];

Remove all previous constraints, add new constraints

[View mas_remakeconstraints:^ (Masconstraintmaker *make) {}];

2.3 Common property settings and usage examples

Make.top.equalTo (self.view.mas_top). offset (+); Top 20 from the bottom of its parent view

Make.left.equalTo (self.view.mas_left). Offset (0); Left border from parent view 0

Make.width.mas_equalTo (+); Set width

Make.top.equalTo (view2.mas_top); setting is equal to the top of the View2

Make.center.equalTo (self.view); Set equal to the center of the parent view

Use of third-party framework masonry to implement layouts

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.