xcode7 configure Masonry

1. Add in Podfile

 

platform :ios, '7.0'

pod 'Masonry'

 

 

2. Run pod install to install

 

3. Join in pch

// As long as this macro is added, no mas_ prefix is ​​required

#define MAS_SHORTHAND

// As long as this macro is added, equalTo is equivalent to mas_equalTo

#define MAS_SHORTHAND_GLOBALS

// This header file must be placed after the above two macros

 

#import "Masonry.h"

 

4. Set in Build Setting

    Precompile Prefix Header 为yes

   Set the Prefix Header to the created pch file (the path should be correct, you can use the absolute path, you can use $(SRCROOT) these variables)

If there is an error, check whether the added path is correct. (If you write $(SRCROOT) at the beginning, then build it in the root directory, if it is $(PROJECT_DIR), it doesn't matter) 

 

5. Run build

 

 

6. Use in code

    UIView *sv=[UIViewnew];

    [sv mas_makeConstraints:^(MASConstraintMaker *make) {

       ///TODO add constraints

   }];

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327071176&siteId=291194637