Use Masonry to Compile Auto Layout-configure Masonry and masonrylayout-in pure code mode --

Source: Internet
Author: User

Use Masonry to Compile Auto Layout-configure Masonry and masonrylayout-in pure code mode --

Auto Layout is very awesome, right? However, apple's default method of writing Auto Layout with code is too bad... The same nightmare!
But as a hand (also) code (love) Love (installed) Good (X), using StoryBoard is obviously not our dish!
By the way, I forgot to say that SizeClass is cool and uses IB, but don't worry. We should at least adapt to iOS7, that is, size Class has been very popular for some time, so there will certainly be a great God (or you) to find out the Size Class code solution!
Let's get back to code Auto Layout.
Native is too troublesome to discuss.
The two good packages I know are Masonry and pure layout. But check out git, and PureLayout has not been updated for more than half a year! Therefore, we will not consider it. Next we will introduce the use of Masonry.

You can download the sample code from github.
The readme contains the installation process.

Or you can view my files.

1. Compile Podfile
Pod 'masonry'
2. Go to the Podfile directory, and then run pod install for automatic installation.

3. Define a macro in any global location (or in any file, so you can use it anyway)

# Define MAS_SHORTHAND

4. Introduce the header file
# Import "Masonry. h"

At this point, the configuration is complete.

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.