Write Auto layout--configuration by using masonry in pure code mode masonry

Source: Internet
Author: User

Auto layout is awesome right, but Apple's default way of writing Auto layout with code is too chicken ... Like a nightmare!
But as a hand (also) code (Love) Love (Pack) Good (X), with StoryBoard is obviously not our dish!
By the way, forget to say, Sizeclass is very cool, and is using IB to do, but don't worry, we should at least adapt to iOS7, that is, size class to very popular still have a period of time, then there must be big God (or you) find out the Size class code solution!
Let's go back to code writing Auto Layout.
The original is too troublesome to be discussed.
Two of the better packages I know are: masonry and pure layout. But look at Git,purelayout has not been updated for half a year! So, don't think about it. Let's introduce the use of masonry.

You can download the sample code from GitHub
Inside the Readme there is the installation process

Or you can look at me, too.

1. Writing Podfile
pod ‘Masonry‘
2. Enter the Podfile directory and install the pod install automatically

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

#define MAS_SHORTHAND

4. Introduction of header Files
#import "Masonry.h"

Here, the configuration is complete

Write Auto layout--configuration by using masonry in pure code mode 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.