Full Code of biggercoffee/ZXPAutoLayout for AI

master 6963ac59add6 cached
32 files
147.6 KB
42.1k tokens
1 requests
Download .txt
Repository: biggercoffee/ZXPAutoLayout
Branch: master
Commit: 6963ac59add6
Files: 32
Total size: 147.6 KB

Directory structure:
gitextract_zbe98yoz/

├── .gitignore
├── LICENSE
├── README.md
├── ZXPAutoLayout/
│   ├── ZXPAutoLayout.h
│   └── ZXPAutoLayout.m
├── ZXPAutoLayout.podspec
└── ZXPAutoLayoutDemo/
    ├── ZXPAutoLayoutDemo/
    │   ├── AppDelegate.h
    │   ├── AppDelegate.m
    │   ├── Assets.xcassets/
    │   │   ├── AppIcon.appiconset/
    │   │   │   └── Contents.json
    │   │   └── Contents.json
    │   ├── Base.lproj/
    │   │   ├── LaunchScreen.storyboard
    │   │   └── Main.storyboard
    │   ├── Info.plist
    │   ├── SimpleViewController.h
    │   ├── SimpleViewController.m
    │   ├── TableViewController.h
    │   ├── TableViewController.m
    │   ├── TableViewController.xib
    │   ├── TestTableViewCell.h
    │   ├── TestTableViewCell.m
    │   ├── TestTableViewCell.xib
    │   ├── ViewController.h
    │   ├── ViewController.m
    │   ├── ZXPStackViewController.h
    │   ├── ZXPStackViewController.m
    │   └── main.m
    ├── ZXPAutoLayoutDemo.xcodeproj/
    │   ├── project.pbxproj
    │   └── project.xcworkspace/
    │       └── contents.xcworkspacedata
    ├── ZXPAutoLayoutDemoTests/
    │   ├── Info.plist
    │   └── ZXPAutoLayoutDemoTests.m
    └── ZXPAutoLayoutDemoUITests/
        ├── Info.plist
        └── ZXPAutoLayoutDemoUITests.m

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: README.md
================================================
# ZXPAutoLayout
## 方便简洁的ios自动布局
## 此处简单入门但也足以, 如需深入一点了解, 可以查看这篇博文, 详细讲解了ZXPAutoLayout的使用 : [http://www.jianshu.com/p/0ed897e93909](http://www.jianshu.com/p/0ed897e93909)
## v1.1.0版本已加入一行搞定`cell的自适应高度`,只需要调用`zxp_cellHeightWithindexPath:`方法即可.详情看demo.
> cell自适应注意:在tableView: cellForRowAtIndexPath: 方法里请用
>    [tableView dequeueReusableCellWithIdentifier:cellid];
>    方式获取cell
> 
>    请不要使用
>    [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath]; 
>    会造成野指针错误


#什么是ZXPAutoLayout ?

<font size=4>
**iOS原生的自动布局(`NSLayoutConstraint`)非常繁琐, 影响开发进度和可读性也不利于维护, 正所谓工欲善其事必先利其器 , 有一个良好的自动布局框架, 则会让我们事半功倍. 而`ZXPAutoLayout`则是解决这一问题和诞生 . 采用新颖的链式语法, 扩展性,可读性,维护成本也较低.并致力打造最好用,最简洁,最方便,最轻巧的自动布局.** 
**`ps : autolayout简单来说就是 适配iPhone机型并且是0数学布局和兼容横竖屏,如不懂童鞋, 请自寻网上查阅`**
</font>
> <font size=4>**举个例子:**
> **在使用ZXPAutoLayout之前,也就是原生的iOS布局,要添加一个约束是这样的:**</font>
> <pre ><code>
> NSLayoutConstraint *constraint = [NSLayoutConstraint 
> constraintWithItem:view //第一个view
> attribute:NSLayoutAttribute //约束属性, 比如上下左右宽高等间距
> relatedBy:NSLayoutRelationEqual //相等,或者大于等于,小于等于
> toItem:secondView //第二个view,也就是第一个view是要参照第二个view的
> attribute:NSLayoutAttribute //参照第二个view的属性
> multiplier:multiplier  //比例0--1
> constant:0]; //约束值
> </code></pre>
>**<font size=4> 就这样随便加一个约束就如此的繁琐,更何况一个view最起码有上边距,左边距和宽高,也就是所谓的`x,y,width,height`四个基本属性.就相当于以上那复杂的代 码就要最少写四次.** </font>

<font size=4>  **而现在用<font color=red size=5>`ZXPAutoLayout`</font>来给一个view添加上边距,左边距,宽高.** </font>
```objctive-c
//设置一个背景为半透明红色的view,上下左右四边都距离superview的距离为10
    UIView *bgView = [UIView new];
    [self.view addSubview:bgView];
    bgView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:.5];
    [bgView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        //上下左右四边都距离superview的距离为10
        layout.edgeInsets(UIEdgeInsetsMake(10, 10, 10, 10));
        
        //也可以如下这行代码来设置,但要同时设置top,left,bottom,right.推荐以上写法,比较简洁.
        //layout.topSpace(10).leftSpace(10).bottomSpace(10).rightSpace(10);
    }];
```
</p>
</p>
# 加入ZXPAutoLayout !
###  第一种方式:直接去github上下载:[https://github.com/biggercoffee/ZXPAutoLayout](https://github.com/biggercoffee/ZXPAutoLayout)
<p></p>
### 第二种方式: 直接在Cocoapods里搜索ZXPAutoLayout <font color=brown>(不知道什么是cocoapods或者使用方法者请自行百度, Google, 网上一大堆资料). </font>搜索命令:  `pod search zxpautolayout` 然后在安装到你的cocoapods里.  <p></p><font color=red>注意:有些用Cocoapods搜索出来的版本不是最新或者无法搜索到的, 请升级一下cocoapods即可</font>

#如何使用它?
<font size=4>**在需要的地方导入`ZXPAutoLayout.h`头文件即可**</font>
##**`设置一个红色的view,与self.view保持一致, 并适配各个iPhone机型和横竖屏`**
```objective-c
	//设置一个背景为半透明红色的view
    UIView *bgView = [UIView new];
    [self.view addSubview:bgView];
    bgView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:.5];
    [bgView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
	    layout.edgeEqualTo(self.view); //位置和宽度等于self.view
		//也可以如下两种写法
        //上下左右四边都距离superview的距离为0
        //layout.edgeInsets(UIEdgeInsetsMake(0, 0, 0, 0));
        
        //也可以如下这行代码来设置,但要同时设置top,left,bottom,right.推荐以上写法,比较简洁.
        //layout.topSpace(10).leftSpace(10).bottomSpace(10).rightSpace(10);
    }];
```

##**`设置一个蓝色view , 设置在superview里的距离和设置自身的宽高.`**
```objective-c
	UIView *blueView = [UIView new];
    [bgView addSubview:blueView];
    blueView.backgroundColor = [UIColor blueColor];
    [blueView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.topSpace(20); //设置在superview里的上边距
        layout.leftSpace(20); //设置在superview里的左边距
        layout.rightSpace(20); //设置在superview里的右边距
        layout.heightValue(100); //设置高度
        // 注意:
        // 1.设置了左边距和右边距, 会自动拉升宽度,所以如上代码并没有设置宽度.
        // 2.如上代码可以写成一行,比如layout.topSpace(20).leftSpace(20)
        // 3.但是不推荐全部写在一行, 阅读性太差 , 而且在一行代码里写了诸多属性也不利于DEBUG
    }];
```

##**`设置一个灰色view , 设置参照于其他view的距离和等宽等距离属性`**
```objective-c
	UIView *grayView = [UIView new];
    [bgView addSubview:grayView];
    grayView.backgroundColor = [UIColor grayColor];
    [grayView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        /*
            上边距参照blueview, 并加10的距离.
            意思就是说上边距在blueView的下边,并加上10的间距.
            如果只是想在blueview的下边没有距离的话, 第二个参数写为0即可
         */
        layout.topSpaceByView(blueView,10);
        
        /*
            左边距等同于blueView的左边距
            第二个参数是距离的值, 如果为0就代表左边距和blueview相等
            如果不为0,则先相等于blueview的距离,然后在加上第二参数的距离
         */
        layout.leftSpaceEqualTo(blueView,0);
        
        /*
            宽度等同于bluewView
            multiplier是倍数, 可选属性,如果不写此属性宽度就是等同于blueview
            如果写了此属性,如下示例, 则宽度等同于blueview的 0.5 倍
         */
        layout.widthEqualTo(blueView,0).multiplier(0.5);
        layout.heightValue(40); //设置高度
    }];
```

##**`UILabel的文字自适应,只需要设置autoHeight属性即可`**
```objective-c
	UILabel *label = [UILabel new];
    [self.view addSubview:label];
    label.backgroundColor = [UIColor purpleColor];
    label.textColor = [UIColor whiteColor];
    label.text = @"这是文字自适应, 这是文字自适应 ,这是文字自适应 .这是文字自适应";
    [label zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        //设置上边距在grayView的下边,并且加10的距离
        layout.leftSpaceEqualTo(grayView,10);
        
        layout.bottomSpace(20); //设置在superview里的下边距
        
        layout.widthValue(100);//设置宽度
        
        layout.autoHeight(); //自适应高度,只针对UILabel有效
    }];
```

##**`等宽并水平对齐第一种方式`**
```objective-c
		UIView *view1 = [UIView new];
        [self.view addSubview:view1];
        view1.backgroundColor = [UIColor blueColor];
        
        UIView *view2 = [UIView new];
        [self.view addSubview:view2];
        view2.backgroundColor = [UIColor blackColor];
        
        UIView *view3 = [UIView new];
        [self.view addSubview:view3];
        view3.backgroundColor = [UIColor blueColor];
        
        [view1 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpaceByView(grayView,10);
            layout.leftSpace(20);
            layout.heightValue(40);
            layout.widthEqualTo(view2);
        }];
        
        [view2 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpaceEqualTo(view1,0);
            layout.leftSpaceByView(view1,20);
            layout.heightValue(40);
            layout.widthEqualTo(view3);
        }];
        
        [view3 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpaceEqualTo(view1,0);
            layout.leftSpaceByView(view2,20);
            layout.rightSpace(20);
            layout.heightValue(40);
        }];
```

##**`等宽并水平对齐第二种方式 -- ZXPStackView的使用`**
```objective-c
		ZXPStackView *stackView = [ZXPStackView new];
        [self.view addSubview:stackView];
        stackView.backgroundColor = [UIColor blackColor];
        
        //只需要设置stackView的宽高和位置即可
        [stackView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpaceByView(grayView,20);
            layout.leftSpace(0);
            layout.rightSpace(0);
            layout.heightValue(100);
        }];
        
        UIView *view1 = [UIView new];
        [stackView addSubview:view1];
        view1.backgroundColor = [UIColor blueColor];
        
        UIView *view2 = [UIView new];
        [stackView addSubview:view2];
        view2.backgroundColor = [UIColor yellowColor];
        
        UIView *view3 = [UIView new];
        [stackView addSubview:view3];
        view3.backgroundColor = [UIColor redColor];
        
        //stack的内边距
        stackView.padding = UIEdgeInsetsMake(10, 10, 10,10);
        //view直接的距离
        stackView.space = 10;
        //调用此方法会给subviews自动添加约束条件,进行等宽或者等高排列
        [stackView layoutWithType:ZXPStackViewTypeHorizontal];
```

##**`ZXPStackView之等高垂直对齐`**
<font size=4>**只需要调用ZXPStackView的layoutWithType: 方法,并传入ZXPStackViewTypeVertical即可实现,如以上代码一样.只是布局所传入的类型参数不同而已, 内部会根据所传入的布局类型,自动进行约束的添加.**</font>
```objective-c
		ZXPStackView *stackView = [ZXPStackView new];
        [self.view addSubview:stackView];
        stackView.backgroundColor = [UIColor blackColor];
        
        //只需要设置stackView的宽高和位置即可
        [stackView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpaceByView(grayView,20);
            layout.leftSpace(0);
            layout.rightSpace(0);
            layout.heightValue(100);
        }];
        
        UIView *view1 = [UIView new];
        [stackView addSubview:view1];
        view1.backgroundColor = [UIColor blueColor];
        
        UIView *view2 = [UIView new];
        [stackView addSubview:view2];
        view2.backgroundColor = [UIColor yellowColor];
        
        UIView *view3 = [UIView new];
        [stackView addSubview:view3];
        view3.backgroundColor = [UIColor redColor];
        
        //stack的内边距
        stackView.padding = UIEdgeInsetsMake(10, 10, 10,10);
        //view直接的距离
        stackView.space = 10;
        //调用此方法会给subviews自动添加约束条件,进行等宽或者等高排列
        [stackView layoutWithType:ZXPStackViewTypeVertical];
```

## <font color=red>**注意: ZXPStackView的subview不需要添加约束, 在调用`layoutWithType: `方法的时候,内部会自动进行约束的添加 **</font>

#**总结**
###**本篇文章讲解了`ZXPAutoLayout`的基本使用和常用api的方法. 比如如何设置一个view的约束, 或者等宽, 等高, 位置相对于某个view的某一边,  宽高又相对于某一个view或者等比例的常用apis. `如有问题或者写的不好地方留言即可~!`**

#### 有任何问题欢迎issue我,你们的issue才是我的动力~! thanks


================================================
FILE: ZXPAutoLayout/ZXPAutoLayout.h
================================================

/*
 
 ***************** ***************** ***************** *****************
 
 version : 2.0.1
 support : Xcode7.0以上 , iOS 7 以上
 简洁方便的autolayout, 打造天朝最优, 最简洁方便, 最容易上手的autolayout
 github : https://github.com/biggercoffee/ZXPAutolayout
 blog : http://xiaopingblog.cn/
 Email: z_xiaoping@163.com
 
 ***************** ***************** ***************** *****************
 */

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

#pragma mark - ZXPStackViewType

typedef NS_ENUM(NSUInteger, ZXPStackViewType) {
    /**
     *  水平对齐
     */
    ZXPStackViewTypeHorizontal = 1,
    /**
     *  垂直对齐
     */
    ZXPStackViewTypeVertical
};

@class ZXPAutoLayoutFactory;

#pragma mark - ZXPStackView class

@interface ZXPStackView : UIView

/**
 *  内边距
 */
@property (assign,nonatomic) UIEdgeInsets padding;

/**
 *  view之间的距离
 */
@property (assign,nonatomic) CGFloat space;

/**
 *  根据对齐类型进行布局
 *
 *  @param type ZXPStackViewTypeHorizontal or ZXPStackViewTypeVertical
 */
- (void)layoutWithType:(ZXPStackViewType)type;

@end

#pragma mark - ZXPAutoLayoutMaker class

@interface ZXPAutoLayoutMaker : NSObject

/*
 设置在superview里的距离
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^topSpace)(CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^leftSpace)(CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^bottomSpace)(CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^rightSpace)(CGFloat value);

/**
 *  设置在superview里的top,left,bottom,right的间距
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^edgeInsets)(UIEdgeInsets insets);

/**
 *  top,left,bottom,right与某一个view的top,left,bottom,right相等
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^edgeEqualTo)(UIView *view);

/*
 居中操作,\
 第一个参数是参考某一个view进行居中
 第二个参数是参考某一个view居中过后在加上多少距离
 例子:
 layout.centerByView(superview); //在父视图中居中
 layout.centerByView(superview,100.0);//在父视图中居中并且x,y在累加100的距离
 其他用法同上~!
 */
//参考某一个view进行水平居中
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^xCenterByView)(UIView *view,CGFloat value);
//参考某一个view进行垂直居中
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^yCenterByView)(UIView *view,CGFloat value);
//参考某一个view进行居中
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^centerByView)(UIView *view,CGFloat value);

/*
 边距和宽高带有 EqualTo 或者 ByView 结尾的方法都带有两个参数.
 第一个参数为其他view
 第二个参数为在此基础之上累加的数值, 可传递可不传递,默认0. 接收浮点型
 公式: view(第一个参数) + 值(第二个参数)
 */

/*
 设置距离其它view的间距, 两个参数
 @param view  其它view
 @param ... 距离多少间距
 公式: view(第一个参数) + 值(第二个参数)
 
 例子:
 layout.topSpaceByView(otherView); //上边距离参考其他view, 也就是在某一个view的下边
 layout.topSpaceByView(otherView,100);//上边距离参考其他view, 也就是在某一个view的下边并且在累加100的距离
 其他用法同上~!
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^topSpaceByView)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^leftSpaceByView)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^bottomSpaceByView)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^rightSpaceByView)(UIView *view,CGFloat value);

/*
 @param view 设置view的距离参照与某一个view.有两个参数, 第一个是view, 第二个是value
 @param ...第二个参数
 如果第二个参数value 为0, 则距离等同于参照view的距离.
 如果第二个参数value不为0, 则在参照的view的基础之上加上这个参数的值
 公式 : 其他view的距离 + value
 例子: 同上~!
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^topSpaceEqualTo)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^leftSpaceEqualTo)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^bottomSpaceEqualTo)(UIView *view,CGFloat value);
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^rightSpaceEqualTo)(UIView *view,CGFloat value);

/*
 设置宽高与其他view相等
 公式 : 其他view的宽或者高 + value
 @param view  其它view
 @param value 在参照的view的基础之上加上这个参数的值
 例子: 同上~!
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^widthEqualTo)(UIView *view,CGFloat value);
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^heightEqualTo)(UIView *view,CGFloat value);

/*
 设置宽高
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^widthValue)(CGFloat value);
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^heightValue)(CGFloat value);

/**
 根据文字自适应高度, 只针对UILabel控件生效. 最小值为0
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^autoHeight)();

/**
 根据最小值进行文字自适应高度, 只针对UILabel控件生效.
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^autoHeightByMin)(CGFloat value);

/**
 根据文字自适应宽度, 只针对UILabel控件生效. 最小值为0
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^autoWidth)();

/**
 根据最小值文字自适应宽度, 只针对UILabel控件生效.
 */
@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^autoWidthByMin)(CGFloat value);

/**
 *  优先级
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^priority)(UILayoutPriority priority);

/**
 *  倍数,原始值的多少倍,此函数只针对最后一次设置的约束生效,
 例如: layout.topSpace(10).leftSpace(10).widthEqualTo(view1).multiplier(0.5).heightValue(40);
 在这行代码里的倍数,只针对宽度生效,表示宽度是view1宽度的0.5倍.
 如果想给多个属性增加倍数,则在对应的后面写上multiplier属性即可
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^multiplier)(CGFloat multiplier);

//init
- (instancetype)initWithView:(UIView *)view type:(id)type;

#pragma mark - deprecated apis

// ---------------- 以下是1.0以前的布局方式, 不推荐使用 -------------------

@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *top __deprecated_msg("use topSpace"); /**< 上边距 */
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *left __deprecated_msg("use leftSpace"); /**< 左边距 */
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *bottom __deprecated_msg("use bottomSpace"); /**< 下边距 */
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *right __deprecated_msg("use rightSpace"); /**< 右边距 */
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *leading __deprecated_msg("use leftSpace");
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *trailing __deprecated_msg("use rightSpace");

//居中
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *center __deprecated_msg("use centerByView");
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *centerX __deprecated_msg("use xCenterByView");
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *centerY __deprecated_msg("use yCenterByView");

@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *width __deprecated_msg("use widthValue"); /**< 宽度 */
@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *height __deprecated_msg("use heightValue"); /**< 高度 */

@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *edges __deprecated_msg("use edgeInsets"); /**< add top,left,bottom, right */

@property (strong, nonatomic, readonly) ZXPAutoLayoutMaker *with __deprecated_msg("不推荐使用");

//---- setting constraints
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^offset)(CGFloat offset) __deprecated_msg("不推荐使用"); /**< setting constant */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^equalTo)(id value) __deprecated_msg("不推荐使用"); /**< 如果是nsnumber类型就设置约束的值 , 如果是uiview类型就设置为相等于另一个view的约束 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^sizeOffset)(CGSize size) __deprecated_msg("不推荐使用"); /**< setting width,height */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^originOffset)(CGPoint origin) __deprecated_msg("不推荐使用"); /**< setting top,left */

@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^frameOffset)(CGRect frame) __deprecated_msg("不推荐使用");

@property (copy,nonatomic,readonly) ZXPAutoLayoutMaker *(^insets)(UIEdgeInsets insets) __deprecated_msg("不推荐使用");

//大于等于,小于等于
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^greaterThanOrEqual)(id value) __deprecated_msg("不推荐使用"); /**< 大于等于 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^lessThanOrEqual)(id value) __deprecated_msg("不推荐使用"); /**< 小于等于 */

@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^equalToWithMultiplier)(id value,CGFloat multiplier) __deprecated_msg("不推荐使用");

@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^greaterThanOrEqualWithMultiplier)(id value,CGFloat multiplier) __deprecated_msg("不推荐使用");

@property (copy, nonatomic, readonly) ZXPAutoLayoutMaker *(^lessThanOrEqualWithMultiplier)(id value,CGFloat multiplier) __deprecated_msg("不推荐使用");

@end

#pragma mark - category UIView + ZXPAdditions

@interface UIView (ZXPAdditions)

//attributes
@property (nonatomic,strong,readonly) id zxp_top __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_left __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_bottom __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_right __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_leading __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_trailing __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_width __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_height __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_centerX __deprecated_msg("不推荐使用");
@property (nonatomic,strong,readonly) id zxp_centerY __deprecated_msg("不推荐使用");

//add
- (void)zxp_addConstraints:(void(^)(ZXPAutoLayoutMaker *layout))layout;

//update
- (void)zxp_updateConstraints:(void(^)(ZXPAutoLayoutMaker *layout))layout;

//print
- (void)zxp_printConstraintsForSelf;

#pragma mark - 2.0 全新的APIS

/**
 *  添加布局
 *  示例:[view zxp_addAutoLayouts:^{
                                     zxp_layout_center(self.view),
                                     zxp_layout_height(100),
                                     zxp_layout_widthEqualTo(self.view).multiplier(0.5)
                                     }];
 *  @param makers 装载的是ZXPAutoLayoutFactory对象,可通过 zxp_layout_xxx 函数来获取,列如zxp_layout_top | zxp_layout_left | zxp_layout_right | zxp_layout_bottom 等等,详情请参照API。(参照 ZXPAutoLayout.h 文件的最底部为可用APIS)
 */
- (void)zxp_addAutoLayouts:(void(^)(void))block;

/**
 *  更新布局(只能更新以添加过的约束)
 *  示例:[view zxp_updateAutoLayouts:^{
                                     zxp_layout_center(self.view,100),
                                     zxp_layout_height(50),
                                     zxp_layout_widthEqualTo(self.view).multiplier(0.8)
                                     }];
 *  @param makers 装载的是ZXPAutoLayoutFactory对象,可通过 zxp_layout_xxx 函数来获取,列如zxp_layout_top | zxp_layout_left | zxp_layout_right | zxp_layout_bottom 等等,详情请参照API。(参照 ZXPAutoLayout.h 文件的最底部为可用APIS)
 */
- (void)zxp_updateAutoLayouts:(void(^)(void))block;

/**
 *  根据子视图获取当前视图适合的高
 *
 *  @param view subview
 *
 *  @return height
 */
- (CGFloat)zxp_fittingHeightWithSubview:(UIView *)view;

/**
 *  根据子视图获取当前视图适合的宽
 *
 *  @param view subview
 *
 *  @return width
 */
- (CGFloat)zxp_fittingWidthWithSubview:(UIView *)view;

@end

#pragma mark - category UITableView + ZXPCellAutoHeight

@interface UITableView (ZXPCellAutoHeight)

/**
 *  cell的高度自适应, 在tableView: cellForRowAtIndexPath: 方法里请用
 [tableView dequeueReusableCellWithIdentifier:cellid];
 方式获取cell
 
 请不要使用
 [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath];
 会造成野指针错误
 *
 *  @param indexPath indexPath
 *
 *  @return 返回cell.contentView的子视图里 y+height 最大值的数值
 */
- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath;

/**
 *   cell的高度自适应, 在tableView: cellForRowAtIndexPath: 方法里请用
 [tableView dequeueReusableCellWithIdentifier:cellid];
 方式获取cell
 
 请不要使用
 [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath];
 会造成野指针错误
 *
 *  @param indexPath indexPath
 *  @param block     block
 *
 *  @return 返回block里return view的 y+height
 */
- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath bottomView:(UIView *(^)(__kindof UITableViewCell *cell))block;

/**
 *   cell的高度自适应, 在tableView: cellForRowAtIndexPath: 方法里请用
 [tableView dequeueReusableCellWithIdentifier:cellid];
 方式获取cell
 
 请不要使用
 [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath];
 会造成野指针错误
 *
 *  @param indexPath indexPath
 *  @param block     block
 *  @param space     space
 *
 *  @return 返回block里return view的 y+height+space
 */
- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath bottomView:(UIView *(^)(__kindof UITableViewCell *cell))block space:(CGFloat)space;;

/**
 *   cell的高度自适应, 在tableView: cellForRowAtIndexPath: 方法里请用
 [tableView dequeueReusableCellWithIdentifier:cellid];
 方式获取cell
 
 请不要使用
 [tableView dequeueReusableCellWithIdentifier:cellid forIndexPath:indexPath];
 会造成野指针错误
 *
 *  @param indexPath indexPath
 *  @param space     space
 *
 *  @return 返回cell.contentView的子视图里 y+height 最大值的数值 并且加上space参数的值
 */
- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath space:(CGFloat)space;

@end

@interface ZXPAutoLayoutFactory : NSObject

/**
 *  优先级
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutFactory *(^priority)(UILayoutPriority priority);

/**
 *  倍数
 */
@property (copy, nonatomic, readonly) ZXPAutoLayoutFactory *(^multiplier)(CGFloat multiplier);

@end

//-----------------------------------------------------

#pragma mark - 生产 zxp_layout 的C函数

#pragma mark 约束值

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_top(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_left(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_right(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottom(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_width(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_height(CGFloat constant);

extern ZXPAutoLayoutFactory * zxp_layout_edge(UIEdgeInsets insets);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_top(void);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_left(void);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_right(void);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottom(void);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_width(void);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_height(void);

extern ZXPAutoLayoutFactory * zxp_layout_widthGreaterThanOrEqual(CGFloat constant);
extern ZXPAutoLayoutFactory * zxp_layout_heightGreaterThanOrEqual(CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_center(UIView *secondView,CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_center(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_centerX(UIView *secondView,CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_centerX(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_centerY(UIView *secondView,CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_centerY(UIView *secondView);

#pragma mark 等同于参照view的约束

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_topEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_topEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_leftEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_leftEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottomEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottomEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_rightEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_rightEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_widthEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_widthEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_heightEqualTo(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_heightEqualTo(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_widthEqualToHeight(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_widthEqualToHeight(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_heightEqualToWidth(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_heightEqualToWidth(UIView *secondView);

#pragma mark 某一边距参照某一个view来设置

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_topByView(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_topByView(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_leftByView(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_leftByView(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottomByView(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_bottomByView(UIView *secondView);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_rightByView(UIView *secondView, CGFloat constant);

__attribute__((__overloadable__)) extern ZXPAutoLayoutFactory * zxp_layout_rightByView(UIView *secondView);

#pragma mark - end 生产 zxp_layout 的C函数









================================================
FILE: ZXPAutoLayout/ZXPAutoLayout.m
================================================

#import "ZXPAutoLayout.h"
#import <objc/runtime.h>

#pragma mark - NSLayoutAttribute convert string

NSString* p_zxp_layoutAttributeString(NSLayoutAttribute attribute) {
    NSString *attributeString;
#define enumToString(value) case value : attributeString = @#value; break;
    switch (attribute) {
            enumToString(NSLayoutAttributeLeft)
            enumToString(NSLayoutAttributeRight)
            enumToString(NSLayoutAttributeTop)
            enumToString(NSLayoutAttributeBottom)
            enumToString(NSLayoutAttributeLeading)
            enumToString(NSLayoutAttributeTrailing)
            enumToString(NSLayoutAttributeWidth)
            enumToString(NSLayoutAttributeHeight)
            enumToString(NSLayoutAttributeCenterX)
            enumToString(NSLayoutAttributeCenterY)
        default:
            enumToString(NSLayoutAttributeNotAnAttribute)
    }
#undef enumToString
    return attributeString;
}

#pragma mark - end NSLayoutAttribute convert string

static NSString * const kZXPAutoLayoutMakerAdd       = @"ZXPAutoLayoutMakerAdd-zxp";
static NSString * const kZXPAutoLayoutMakerUpdate    = @"ZXPAutoLayoutMakerUpdate-zxp";
static NSString * const kZXPAttributeKey             = @"ZXPAttributeKey-zxp";

static NSString * const kZXPAutoLayoutForArrayObject = @"kZXPAutoLayoutForArrayObject-zxp";
static void * kZXPAutoLayoutForArrayKey              = &kZXPAutoLayoutForArrayKey;

static NSString * const kZXPAutoLayoutForArrayForLockObject = @"kZXPAutoLayoutForArrayForLockObject-zxp";
static void * kZXPAutoLayoutForArrayForLockKey              = &kZXPAutoLayoutForArrayForLockKey;

#pragma mark - private category of array

@interface NSArray (ZXPPrivateOfAutoLayout)

- (NSArray *)distinctUnionOfObjects;

@end

@implementation NSArray (ZXPPrivateOfAutoLayout)

- (NSArray *)distinctUnionOfObjects {
    return [self valueForKeyPath:@"@distinctUnionOfObjects.self"];
}

@end

#pragma mark - ZXPStackView class

@implementation ZXPStackView

- (void)layoutWithType:(ZXPStackViewType)type {
    NSInteger subviewCount = self.subviews.count;
    
    [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        [obj zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            if (type == ZXPStackViewTypeHorizontal) { //水平
                if (!idx) {
                    layout.leftSpace(self.padding.left);
                }
                else {
                    layout.leftSpaceByView(self.subviews[idx - 1],self.space);
                }
                if (subviewCount - 1 == idx) {
                    layout.rightSpace(self.padding.right);
                }
                else {
                    layout.widthEqualTo(self.subviews[idx + 1],0);
                }
                layout.topSpace(self.padding.top);
                layout.bottomSpace(self.padding.bottom);
            }
            else if (type == ZXPStackViewTypeVertical) { //垂直
                if (!idx) {
                    layout.topSpace(self.padding.top);
                }
                else {
                    layout.topSpaceByView(self.subviews[idx - 1],self.space);
                }
                
                if (subviewCount - 1 == idx) {
                    layout.bottomSpace(self.padding.bottom);
                }
                else {
                    layout.heightEqualTo(self.subviews[idx + 1],0);
                }
                layout.leftSpace(self.padding.left);
                layout.rightSpace(self.padding.right);
            }
        }];
    }];
    
}

@end

#pragma mark - ZXPAutoLayoutFactory class

@interface ZXPAutoLayoutFactory ()

@property (nonatomic, assign) CGFloat            layoutConstant;
@property (nonatomic, assign) UILayoutPriority   layoutPriority;
@property (nonatomic, assign) NSLayoutAttribute  layoutFirstAttribute;
@property (nonatomic, assign) NSLayoutAttribute  layoutSecondAttribute;
@property (nonatomic, assign) CGFloat            layoutMultiplierValue;
@property (nonatomic, assign) BOOL               layoutAutoHeight;
@property (nonatomic, assign) BOOL               layoutAutoWidth;
@property (nonatomic,strong ) UIView             *layoutSecondView;
@property (nonatomic,copy   ) NSArray<ZXPAutoLayoutFactory *> *layoutCenters;
@property (nonatomic,copy   ) NSArray<ZXPAutoLayoutFactory *> *layoutInsets;
@property (nonatomic,strong) ZXPAutoLayoutMaker *marker;

@property (nonatomic, assign) BOOL               widthEqualToHeight;
@property (nonatomic, assign) BOOL               heightEqualToWidth;

+ (void)p_layoutMakerLockWithBlock:(void(^)(void))block;

@end

#pragma mark - ZXPAutoLayoutMaker class

@interface ZXPAutoLayoutMaker ()

@property (nonatomic,strong) NSMutableArray *constraintAttributes;

@property (nonatomic,strong) NSMutableArray<NSLayoutConstraint *> *tempRelatedConstraints;

@property (nonatomic,strong) UIView *view;
@property (nonatomic,strong) NSLayoutConstraint *lastConstraint;
@property (nonatomic,copy) NSString *layoutType;

@end

@implementation ZXPAutoLayoutMaker

+ (void)load {
    
    //-------- 已废弃, 保留1.0之前的api实现 --------
    NSMutableArray<NSString *> *layoutAttributeStringList = [NSMutableArray array];
    NSMutableArray<NSNumber *> *layoutAttributeValueList = [NSMutableArray array];
#define enumToString(value) [layoutAttributeStringList addObject:@#value]; \
[layoutAttributeValueList addObject:@(value)];
    enumToString(NSLayoutAttributeLeft)
    enumToString(NSLayoutAttributeRight)
    enumToString(NSLayoutAttributeTop)
    enumToString(NSLayoutAttributeBottom)
    enumToString(NSLayoutAttributeLeading)
    enumToString(NSLayoutAttributeTrailing)
    enumToString(NSLayoutAttributeWidth)
    enumToString(NSLayoutAttributeHeight)
    enumToString(NSLayoutAttributeCenterX)
    enumToString(NSLayoutAttributeCenterY)
#undef enumToString
    
    objc_setAssociatedObject([self class], @selector(swizzleMethodForAttribute),
                             @{@"keys":layoutAttributeStringList,
                               @"values":layoutAttributeValueList},
                             OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    
    NSArray<NSString *> *methods = @[NSStringFromSelector(@selector(top)),
                                     NSStringFromSelector(@selector(left)),
                                     NSStringFromSelector(@selector(bottom)),
                                     NSStringFromSelector(@selector(right)),
                                     NSStringFromSelector(@selector(width)),
                                     NSStringFromSelector(@selector(height)),
                                     NSStringFromSelector(@selector(centerX)),
                                     NSStringFromSelector(@selector(centerY)),
                                     NSStringFromSelector(@selector(center))];
    
    [methods enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        SEL aSel = NSSelectorFromString(obj);
        method_setImplementation(
                                 class_getInstanceMethod(ZXPAutoLayoutMaker.class,aSel),
                                 class_getMethodImplementation(ZXPAutoLayoutMaker.class, @selector(swizzleMethodForAttribute)));
    }];
    //---------- 以上是已废弃的代码, 保留1.0之前的api实现 --------------
}

#pragma mark - swizzle
/**
 *  @author coffee
 *
 *  @brief 已废弃,保留1.0之前的api接口实现
 *
 *  @return self
 */
- (id)swizzleMethodForAttribute  __deprecated_msg("过期") {
    
    NSString *methodName = NSStringFromSelector(_cmd);
    if ([methodName isEqualToString:@"center"]) {
        return self.centerByView(self.view.superview,0);
    }
    
    //remove tempRelatedConstraints
    [self.tempRelatedConstraints removeAllObjects];
    
    //get data for attributes
    NSDictionary *attributeData = objc_getAssociatedObject([self class], @selector(swizzleMethodForAttribute));
    NSMutableArray<NSString *> *layoutAttributeStringList = attributeData[@"keys"];
    NSMutableArray<NSNumber *> *layoutAttributeValueList = attributeData[@"values"];
    
    //get attribute for this
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self endswith[c] %@",methodName];
    NSString *layoutAttributeString = [layoutAttributeStringList filteredArrayUsingPredicate:predicate].firstObject;
    NSUInteger index = [layoutAttributeStringList indexOfObject:layoutAttributeString];
    
    //add constraints attribute
    [self.constraintAttributes addObject:layoutAttributeValueList[index]];
    
    return self;
}

#pragma mark - public

- (instancetype)initWithView:(UIView *)view type:(id)type {
    
    if (self = [super init]) {
        
        self.constraintAttributes = [NSMutableArray array];
        self.tempRelatedConstraints = [NSMutableArray array];
        
        self.view = view;
        self.layoutType = type;
        self.view.translatesAutoresizingMaskIntoConstraints = NO;
    }
    
    return self;
}

#pragma mark 设置在superview里的距离

- (ZXPAutoLayoutMaker *(^)(CGFloat))topSpace {
    return ^(CGFloat value) {
        return [self p_addOrUpdateSpaceInSuperview:NSLayoutAttributeTop constant:value];
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))leftSpace {
    return ^(CGFloat value) {
        return [self p_addOrUpdateSpaceInSuperview:NSLayoutAttributeLeft constant:value];
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))bottomSpace {
    return ^(CGFloat value) {
        return [self p_addOrUpdateSpaceInSuperview:NSLayoutAttributeBottom constant:value];
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))rightSpace {
    return ^(CGFloat value) {
        return [self p_addOrUpdateSpaceInSuperview:NSLayoutAttributeRight constant:value];
    };
}

- (ZXPAutoLayoutMaker *(^)(UIEdgeInsets))edgeInsets {
    return ^(UIEdgeInsets edge) {
        return self.topSpace(edge.top).leftSpace(edge.left).bottomSpace(edge.bottom).rightSpace(edge.right);
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *))edgeEqualTo {
    return ^(UIView *view) {
        return self.topSpaceEqualTo(view,0).leftSpaceEqualTo(view,0).bottomSpaceEqualTo(view,0).rightSpaceEqualTo(view,0);
    };
}

#pragma mark 居中

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))xCenterByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeCenterX multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))yCenterByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeCenterY multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))centerByView {
    return ^(UIView *view,CGFloat value) {
        return self.xCenterByView(view,value).yCenterByView(view,value);
    };
}

#pragma mark 设置距离其它view的间距
/*
 @param view  其它view
 @param value 距离多少间距
 */

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))topSpaceByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeBottom multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))leftSpaceByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeRight multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))bottomSpaceByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeTop multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))rightSpaceByView {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeLeft multiplier:1 constant:value];
        return self;
    };
}

#pragma mark 设置距离与其他view相等

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))topSpaceEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeTop multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))leftSpaceEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeLeft multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))bottomSpaceEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeBottom multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *, CGFloat))rightSpaceEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeRight multiplier:1 constant:value];
        return self;
    };
}

#pragma mark 设置宽高

- (ZXPAutoLayoutMaker *(^)(CGFloat))widthValue {
    return ^(CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual secondView:nil secondAttribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))heightValue {
    return ^(CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual secondView:nil secondAttribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))widthEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeWidth multiplier:1 constant:value];
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(UIView *,CGFloat))heightEqualTo {
    return ^(UIView *view,CGFloat value) {
        [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual secondView:view secondAttribute:NSLayoutAttributeHeight multiplier:1 constant:value];
        return self;
    };
}

#pragma mark 自适应宽高

- (ZXPAutoLayoutMaker *(^)())autoHeight {
    return ^() {
        return self.autoHeightByMin(0);
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))autoHeightByMin {
    return ^(CGFloat value) {
        if ([self.view isKindOfClass:[UILabel class]]) {
            UILabel *label = (UILabel *) self.view;
            label.numberOfLines = 0;
            [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual secondView:nil secondAttribute:NSLayoutAttributeHeight multiplier:1 constant:value];
        }
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)())autoWidth {
    return ^() {
        return self.autoWidthByMin(0);
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))autoWidthByMin {
    return ^(CGFloat value) {
        if ([self.view isKindOfClass:[UILabel class]]) {
            UILabel *label = (UILabel *) self.view;
            NSInteger line = label.numberOfLines;
            label.numberOfLines = line > 0 ? line : 1;
            [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual secondView:nil secondAttribute:NSLayoutAttributeWidth multiplier:1 constant:value];
        }
        return self;
    };
}

#pragma mark - deprecated public
//--------以下方法都过期不推荐使用-------------

- (ZXPAutoLayoutMaker *)with {
    [self.tempRelatedConstraints removeAllObjects];
    return self;
}

- (ZXPAutoLayoutMaker *)edges {
    return self.top.left.bottom.right;
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))offset {
    return ^(CGFloat offset) {
        return [self setupConstraint:offset relatedBy:NSLayoutRelationEqual multiplierBy:1.0];
    };
}

- (ZXPAutoLayoutMaker *(^)(id))greaterThanOrEqual {
    return ^(id value) {
        return self.greaterThanOrEqualWithMultiplier(value,1.0);
    };
}

- (ZXPAutoLayoutMaker *(^)(id))lessThanOrEqual {
    return ^(id value) {
        return self.lessThanOrEqualWithMultiplier(value,1.0);
    };
}

- (ZXPAutoLayoutMaker *(^)(id ))equalTo {
    return ^(id value) {
        return self.equalToWithMultiplier(value,1.0);
    };
}

- (ZXPAutoLayoutMaker *(^)(CGSize))sizeOffset {
    return ^(CGSize size) {
        self.width.offset(size.width);
        self.height.offset(size.height);
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(CGPoint))originOffset {
    return ^(CGPoint origin) {
        self.top.offset(origin.y);
        self.left.offset(origin.x);
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(CGRect))frameOffset {
    return ^(CGRect frame) {
        return self.top.offset(CGRectGetMinY(frame)).left.offset(CGRectGetMinX(frame)).width.offset(CGRectGetWidth(frame)).height.offset(CGRectGetHeight(frame));
    };
}

- (ZXPAutoLayoutMaker *(^)(UIEdgeInsets))insets {
    return ^(UIEdgeInsets insets) {
        return self.top.offset(insets.top).left.offset(insets.left).bottom.offset(insets.bottom).right.offset(insets.right);
    };
}

- (ZXPAutoLayoutMaker *(^)(UILayoutPriority))priority {
    return ^(UILayoutPriority priority) {
        self.lastConstraint.priority = priority;
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(CGFloat))multiplier {
    return ^(CGFloat multiplier) {
        if (self.lastConstraint) {
            [self.view.superview removeConstraint:self.lastConstraint];
            NSLayoutConstraint *obj = self.lastConstraint;
            [self.view.superview addConstraint:[NSLayoutConstraint constraintWithItem:obj.firstItem attribute:obj.firstAttribute relatedBy:obj.relation toItem:obj.secondItem attribute:obj.secondAttribute multiplier:multiplier constant:obj.constant]];
        }
        return self;
    };
}

- (ZXPAutoLayoutMaker *(^)(id, CGFloat))equalToWithMultiplier {
    return ^(id value,CGFloat multiplier) {
        return [self reAddConstraint:value relatedBy:NSLayoutRelationEqual multiplier:multiplier];
    };
}

- (ZXPAutoLayoutMaker *(^)(id, CGFloat))greaterThanOrEqualWithMultiplier {
    return ^(id value,CGFloat multiplier){
        return [self reAddConstraint:value relatedBy:NSLayoutRelationGreaterThanOrEqual multiplier:multiplier];
    };
}

- (ZXPAutoLayoutMaker *(^)(id, CGFloat))lessThanOrEqualWithMultiplier {
    return ^(id value,CGFloat multiplier) {
        return [self reAddConstraint:value relatedBy:NSLayoutRelationLessThanOrEqual multiplier:multiplier];
    };
}

#pragma mark - private methods

- (id)p_addOrUpdateSpaceInSuperview:(NSLayoutAttribute) attribute constant:(CGFloat)constant {
    [self p_addOrUpdateConstraintWithFristView:self.view firstAttribute:attribute relatedBy:NSLayoutRelationEqual secondView:nil secondAttribute:attribute multiplier:1 constant:constant];
    return self;
}

/**
 *  @author coffee
 *
 *  @brief 添加or更新 约束
 *
 *  @param firstView       第一个view
 *  @param firstAttribute  第一个view的属性
 *  @param relation        关系(等于,大于等于,小于等于)
 *  @param secondView      第二个view
 *  @param secondAttribute 第二个view的属性
 *  @param multiplier      比例 ( 0 -- 1 )
 *  @param constant        约束的值
 */
- (void)p_addOrUpdateConstraintWithFristView:(UIView *)firstView firstAttribute:(NSLayoutAttribute)firstAttribute relatedBy:(NSLayoutRelation)relation secondView:(UIView *)secondView secondAttribute:(NSLayoutAttribute)secondAttribute multiplier:(CGFloat)multiplier constant:(CGFloat)constant {
    
    if (self.layoutType == kZXPAutoLayoutMakerAdd) {
        
        NSAssert(self.view.superview, @"请先添加superview : %@",self.view);
        
        [self p_addConstraintWithFristView:firstView firstAttribute:firstAttribute relatedBy:relation secondView:secondView secondAttribute:secondAttribute multiplier:multiplier constant:constant];
    }
    else { //update
        
        if (secondView) {
            [self.view.superview.constraints enumerateObjectsUsingBlock:^(__kindof NSLayoutConstraint * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                
                if (obj.firstItem == self.view && obj.firstAttribute == firstAttribute) {
                    [self.view.superview removeConstraint:obj]; //remove
                }
                
            }];
            [self p_addConstraintWithFristView:firstView firstAttribute:firstAttribute relatedBy:relation secondView:secondView secondAttribute:secondAttribute multiplier:multiplier constant:constant];
        }
        else {
            [self p_updateConstraintWithFirstView:self.view firstAttribute:firstAttribute constant:constant];
        }
    }
    
}

- (void)p_addConstraintWithFristView:(UIView *)firstView firstAttribute:(NSLayoutAttribute)firstAttribute relatedBy:(NSLayoutRelation)relation secondView:(UIView *)secondView secondAttribute:(NSLayoutAttribute)secondAttribute multiplier:(CGFloat)multiplier constant:(CGFloat)constant {
    id view = nil;
    id toItem = nil;
    CGFloat value = firstAttribute == NSLayoutAttributeBottom || firstAttribute == NSLayoutAttributeRight ? 0.0 - constant : constant;
    
    if (firstAttribute == NSLayoutAttributeWidth || firstAttribute == NSLayoutAttributeHeight) {
        if (secondView) {
            view = firstView.superview;
            toItem = secondView?:firstView.superview;
        }
        else {
            view = firstView;
        }
    }
    else {
        view = firstView.superview;
        toItem = secondView?:firstView.superview;
    }
    NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:firstView
                                                                  attribute:firstAttribute
                                                                  relatedBy:relation
                                                                     toItem:toItem
                                                                  attribute:secondAttribute
                                                                 multiplier:multiplier
                                                                   constant:value];
    self.lastConstraint = constraint;
    [view addConstraint:constraint];
}

- (void)p_updateConstraintWithFirstView:(UIView *)view firstAttribute:(NSLayoutAttribute)attribute constant:(CGFloat)constant {
    
    NSArray<__kindof NSLayoutConstraint *> *constraints = attribute == NSLayoutAttributeWidth || attribute == NSLayoutAttributeHeight ? view.constraints : view.superview.constraints;
    [constraints enumerateObjectsUsingBlock:^(__kindof NSLayoutConstraint * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        
        if (attribute == NSLayoutAttributeLeft) {
            if (obj.firstItem == self.view && (obj.firstAttribute == attribute || obj.firstAttribute == NSLayoutAttributeLeading)) {
                obj.constant = constant;
            }
        }
        else if (attribute == NSLayoutAttributeRight) {
            *stop = [self p_updateRightOrBottomWithConstraint:obj firstAttr:NSLayoutAttributeTrailing secondAttr:attribute constant:constant];
        }
        else if (attribute == NSLayoutAttributeBottom) {
            *stop = [self p_updateRightOrBottomWithConstraint:obj firstAttr:NSLayoutAttributeBottom secondAttr:attribute constant:constant];
        }
        else {
            if (obj.firstItem == view && obj.firstAttribute == attribute) {
                obj.constant = constant;
            }
        }
    }];
    
    [self.view layoutIfNeeded];
    
}

- (BOOL)p_updateRightOrBottomWithConstraint:(NSLayoutConstraint *)obj firstAttr:(NSLayoutAttribute)firstAttr secondAttr:(NSLayoutAttribute)secondAttr constant:(CGFloat)constant {
    
    //更新ib里添加的约束, 右边距和下边距要特殊处理
    BOOL ibConstant = (obj.firstItem == self.view.superview && obj.firstAttribute == firstAttr ) && (obj.secondItem == self.view && obj.secondAttribute == firstAttr);
    if ( ibConstant ) { //ib添加的约束
        obj.constant = constant;
        return YES;
    }
    else if ( obj.firstItem == self.view && obj.firstAttribute == secondAttr ) { // ZXPAutoLayout添加的约束
        obj.constant = 0.0 - constant;
        return YES;
    }
    return NO;
}

#pragma mark - deprecated private methods , 保留1.0之前的api所使用的私有方法.

- (id)reAddConstraint:(id)value relatedBy:(NSLayoutRelation)relateBy multiplier:(CGFloat)multiplier {
    if ([value isKindOfClass:[NSNumber class]]) {
        return [self setupConstraint:[value floatValue] relatedBy:relateBy multiplierBy:multiplier];
    }
    else if ([value isKindOfClass:[UIView class]]) {
        return [self reAddConstraintOfAttributesWithToItem:value relatedBy:relateBy multiplierBy:multiplier];
    }
    NSAssert(NO, @"%@ : Does not supper type",self.view);
    return self;
}

- (ZXPAutoLayoutMaker *)setupConstraint:(CGFloat)offset relatedBy:(NSLayoutRelation)related multiplierBy:(CGFloat)multiplier {
    
    NSAssert(self.view.superview, @"%@ , not superview",self.view.class);
    
    if (self.tempRelatedConstraints.count) {
        
        for (NSLayoutConstraint *constraint in self.tempRelatedConstraints) { //update constant in tempRelatedConstraints
            constraint.constant = offset;
        }
        
        //clear
        [self.tempRelatedConstraints removeAllObjects];
        [self.constraintAttributes removeAllObjects];
        
        return self;
    }
    
    NSArray *array = [self.constraintAttributes distinctUnionOfObjects];
    for (id attribute in array) {
        
        NSLayoutAttribute firstAttribute = [attribute integerValue];
        
        if ( self.layoutType == kZXPAutoLayoutMakerAdd ) {
            
            id view = nil;
            id toItem = nil;
            NSLayoutAttribute secondAttribute = NSLayoutAttributeNotAnAttribute;
            
            if (firstAttribute == NSLayoutAttributeWidth || firstAttribute == NSLayoutAttributeHeight) {
                view = self.view;
            }
            else {
                view = self.view.superview;
                toItem = self.view.superview;
                secondAttribute = firstAttribute;
            }
            
            [view addConstraint:[NSLayoutConstraint constraintWithItem:self.view
                                                             attribute:firstAttribute
                                                             relatedBy:related
                                                                toItem:toItem
                                                             attribute:secondAttribute
                                                            multiplier:multiplier
                                                              constant:offset]];
            
        }
        else { //update
            [self p_updateConstraintWithFirstView:self.view firstAttribute:firstAttribute constant:offset];
        }
        
    } //end for
    
    //clear attributes in array
    [self.constraintAttributes removeAllObjects];
    
    return self;
}

- (ZXPAutoLayoutMaker *)reAddConstraintOfAttributesWithToItem:(UIView *)secondView relatedBy:(NSLayoutRelation)related multiplierBy:(CGFloat)multiplier {
    
    NSAssert(self.view.superview, @"%@ , please add superview",self.view.class);
    
    NSArray *distinctUnionAttributes = [self.constraintAttributes distinctUnionOfObjects];
    NSLayoutAttribute secondAttribute = [objc_getAssociatedObject(secondView, &kZXPAttributeKey) integerValue];
    
    if (self.layoutType == kZXPAutoLayoutMakerUpdate) { //如果是更新约束,就先删掉view对应的相对约束
        [self.view.superview.constraints enumerateObjectsUsingBlock:^(__kindof NSLayoutConstraint * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            
            for (id attribute in distinctUnionAttributes) {
                if (obj.firstItem == self.view && obj.firstAttribute == [attribute integerValue]) {
                    [self.view.superview removeConstraint:obj]; //remove
                }
            }
            
        }];
    }
    
    for (id attribute in distinctUnionAttributes) {
        NSLayoutAttribute firstAttribute = [attribute integerValue];
        NSLayoutAttribute toAttribute = secondAttribute != NSLayoutAttributeNotAnAttribute ? secondAttribute : firstAttribute;
        
        //add constraint
        [self addConstraintInSuperviewWithFirstAttribute:firstAttribute toItem:secondView toAttribute:toAttribute relatedBy:related multiplierBy:multiplier];
        [self resetAttributeWithView:secondView];
    }
    
    //clear attributes in array
    [self.constraintAttributes removeAllObjects];
    
    return self;
}

- (void)addConstraintInSuperviewWithFirstAttribute:(NSLayoutAttribute)firstAttribute toItem:(UIView *)view toAttribute:(NSLayoutAttribute)relatedAttribute relatedBy:(NSLayoutRelation)related multiplierBy:(CGFloat)multiplier {
    NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self.view
                                                                  attribute:firstAttribute
                                                                  relatedBy:related
                                                                     toItem:view
                                                                  attribute:relatedAttribute
                                                                 multiplier:multiplier
                                                                   constant:0];
    [self.view.superview addConstraint:constraint];//add constraint in superview
    self.lastConstraint = constraint;
    [self.tempRelatedConstraints addObject:constraint]; //add constraint object in the array
}

- (void)resetAttributeWithView:(UIView *)view {
    NSLayoutAttribute secondAttribute = [objc_getAssociatedObject(view, &kZXPAttributeKey) integerValue];
    if ( secondAttribute != NSLayoutAttributeNotAnAttribute ) {
        objc_setAssociatedObject(view, &kZXPAttributeKey, @(NSLayoutAttributeNotAnAttribute), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
}

@end

@implementation UIView (ZXPAdditions)

- (id)zxp_top {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeTop), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_left {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeLeft), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_bottom {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeBottom), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_right {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeRight), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_leading {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeLeading), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_trailing {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeTrailing), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_width {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeWidth), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_height {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeHeight), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_centerX {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeCenterX), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (id)zxp_centerY {
    objc_setAssociatedObject(self, &kZXPAttributeKey, @(NSLayoutAttributeCenterY), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    return self;
}

- (void)zxp_addConstraints:(void(^)(ZXPAutoLayoutMaker *layout))layout {
    layout([[ZXPAutoLayoutMaker alloc] initWithView:self type:kZXPAutoLayoutMakerAdd]);
}

- (void)zxp_updateConstraints:(void(^)(ZXPAutoLayoutMaker *layout))layout {
    layout([[ZXPAutoLayoutMaker alloc] initWithView:self type:kZXPAutoLayoutMakerUpdate]);
}

- (void)zxp_printConstraintsForSelf {
    NSArray<__kindof NSLayoutConstraint *> *constrain = self.constraints;
    NSArray<__kindof NSLayoutConstraint *> *superConstrain = self.superview.constraints;
    NSMutableArray<__kindof NSLayoutConstraint *> *array = [NSMutableArray array];
    [array addObjectsFromArray:constrain];
    [array addObjectsFromArray:superConstrain];
    [array enumerateObjectsUsingBlock:^(__kindof NSLayoutConstraint * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if (obj.firstItem == self) {
            NSLog(@"%@ -> %@ : %f",[self class],p_zxp_layoutAttributeString(obj.firstAttribute),obj.constant);
        }
    }];
}

#pragma mark 2.0+ 全新API

- (void)zxp_addAutoLayouts:(void(^)(void))block {
    [ZXPAutoLayoutFactory p_layoutMakerLockWithBlock:block];
    [self p_zxp_autoLayoutsWithType:kZXPAutoLayoutMakerAdd];
}

- (void)zxp_updateAutoLayouts:(void (^)(void))block {
    [ZXPAutoLayoutFactory p_layoutMakerLockWithBlock:block];
    [self p_zxp_autoLayoutsWithType:kZXPAutoLayoutMakerUpdate];
}

- (CGFloat)zxp_fittingWidthWithSubview:(UIView *)view {
    return [self p_zxp_fittingSizeWithSubview:view].width;
}

- (CGFloat)zxp_fittingHeightWithSubview:(UIView *)view {
    return [self p_zxp_fittingSizeWithSubview:view].height;
}

#pragma mark 2.0+ private

- (CGSize)p_zxp_fittingSizeWithSubview:(UIView *)view {
    if ((![view isDescendantOfView:self]) || view == self) {
        return CGSizeZero;
    }
    [self layoutIfNeeded];
    return CGSizeMake(CGRectGetMaxX(view.frame), CGRectGetMaxY(view.frame));
}

- (void)p_zxp_addAutoLayoutsWithArray:(NSArray<ZXPAutoLayoutFactory *> *)layouts {
    [self p_zxp_autolayoutWithType:kZXPAutoLayoutMakerAdd makers:layouts];
}

- (void)p_zxp_updateAutoLayoutsWithArray:(NSArray<ZXPAutoLayoutFactory *> *)layouts {
    [self p_zxp_autolayoutWithType:kZXPAutoLayoutMakerUpdate makers:layouts];
}

- (void)p_zxp_autoLayoutsWithType:(NSString *)type {
    NSArray<ZXPAutoLayoutFactory *> *factories = objc_getAssociatedObject(kZXPAutoLayoutForArrayObject, kZXPAutoLayoutForArrayKey);
    
    if (type == kZXPAutoLayoutMakerAdd) {
        [self p_zxp_addAutoLayoutsWithArray:factories];
    }
    else {
        [self p_zxp_updateAutoLayoutsWithArray:factories];
    }
    
    objc_setAssociatedObject(kZXPAutoLayoutForArrayObject, kZXPAutoLayoutForArrayKey, nil, OBJC_ASSOCIATION_ASSIGN);
    factories = nil;
}

- (void)p_zxp_autolayoutWithType:(NSString *)type makers:(NSArray<ZXPAutoLayoutFactory *> *)makers {
    self.translatesAutoresizingMaskIntoConstraints = NO;
    
    [makers enumerateObjectsUsingBlock:^(ZXPAutoLayoutFactory * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        @autoreleasepool {
            ZXPAutoLayoutMaker *maker = [[ZXPAutoLayoutMaker alloc] initWithView:self type:type];
            if (obj.widthEqualToHeight) {
#pragma clang diagnostic ignored"-Wdeprecated-declarations"
                maker.width.equalTo(obj.layoutSecondView.zxp_height).offset(obj.layoutConstant);
            }
            else if (obj.heightEqualToWidth) {
                maker.height.equalTo(obj.layoutSecondView.zxp_width).offset(obj.layoutConstant);
#pragma clang diagnostic pop
            }
            else if (obj.layoutAutoHeight) {
                maker.autoHeight(obj.layoutConstant);
            }
            else if (obj.layoutAutoWidth) {
                maker.autoWidth(obj.layoutConstant);
            }
            else if (obj.layoutSecondView) {
                
                SEL aSel = nil;
                
                if (obj.layoutSecondAttribute == NSLayoutAttributeNotAnAttribute) {
                    aSel = NSSelectorFromString(p_zxp_layout_equalTo_method()[@(obj.layoutFirstAttribute)]);
                }
                else {
                    aSel = NSSelectorFromString(p_zxp_layout_spaceByView_method()[@(obj.layoutFirstAttribute)]);
                }
                
                void(^block)()        = [self p_zxp_makerLayoutGetterBlock_:maker sel:aSel];
                if (block) {
                    block(obj.layoutSecondView,obj.layoutConstant);
                }
                
                if (obj.layoutMultiplierValue) {
                    maker.multiplier(obj.layoutMultiplierValue);
                }
            }
            else if (obj.layoutCenters) {
                if (type == kZXPAutoLayoutMakerAdd) {
                    [self p_zxp_addAutoLayoutsWithArray:obj.layoutCenters];
                }
                else {
                    [self p_zxp_updateAutoLayoutsWithArray:obj.layoutCenters];
                }
            }
            else if (obj.layoutInsets) {
                if (type == kZXPAutoLayoutMakerAdd) {
                    [self p_zxp_addAutoLayoutsWithArray:obj.layoutInsets];
                }
                else {
                    [self p_zxp_updateAutoLayoutsWithArray:obj.layoutInsets];
                }
            }
            else {
                
                SEL aSel       = NSSelectorFromString(p_zxp_layout_space_method()[@(obj.layoutFirstAttribute)]);
                void(^block)() = [self p_zxp_makerLayoutGetterBlock_:maker sel:aSel];
                if (block) {
                    block(obj.layoutConstant);
                }
            }
            
            if (obj.layoutPriority) {
                maker.priority(obj.layoutPriority);
            }
        }
    }];
}

- (void(^)())p_zxp_makerLayoutGetterBlock_:(NSObject *)obj sel:(SEL)aSel {
    if (aSel && class_respondsToSelector([obj class],aSel)) {
        IMP aImp              = [obj methodForSelector:aSel];
        id (*execIMP)(id,SEL) = (void *)aImp;
        return ((void(^)())execIMP(obj,aSel));
    }
    return nil;
}

NSDictionary<NSNumber *,NSString *> *p_zxp_layout_space_method() {
    return @{
             @(NSLayoutAttributeTop):@"topSpace",
             @(NSLayoutAttributeLeft):@"leftSpace",
             @(NSLayoutAttributeRight):@"rightSpace",
             @(NSLayoutAttributeBottom):@"bottomSpace",
             @(NSLayoutAttributeWidth):@"widthValue",
             @(NSLayoutAttributeHeight):@"heightValue",
             };
}

NSDictionary<NSNumber *,NSString *> *p_zxp_layout_equalTo_method() {
    return @{
             @(NSLayoutAttributeTop):@"topSpaceEqualTo",
             @(NSLayoutAttributeLeft):@"leftSpaceEqualTo",
             @(NSLayoutAttributeRight):@"rightSpaceEqualTo",
             @(NSLayoutAttributeBottom):@"bottomSpaceEqualTo",
             @(NSLayoutAttributeWidth):@"widthEqualTo",
             @(NSLayoutAttributeHeight):@"heightEqualTo"
             };
}

NSDictionary<NSNumber *,NSString *> *p_zxp_layout_spaceByView_method() {
    return @{
             @(NSLayoutAttributeTop):@"topSpaceByView",
             @(NSLayoutAttributeLeft):@"leftSpaceByView",
             @(NSLayoutAttributeRight):@"rightSpaceByView",
             @(NSLayoutAttributeBottom):@"bottomSpaceByView",
             @(NSLayoutAttributeCenterX):@"xCenterByView",
             @(NSLayoutAttributeCenterY):@"yCenterByView",
             };
}

@end

#pragma mark - category UITableView + ZXPCellAutoHeight

static NSString * const kZXPTableViewCellHeightDictionary = @"kZXPTableViewCellHeightDictionary_zxp";

NSString *p_zxp_heightDictionaryKey(NSIndexPath *indexPath);
void p_zxp_swizzleMethodOfSelf(Class aClass,SEL sel1,SEL sel2);

@implementation UITableView (ZXPCellAutoHeight)

+ (void)load {
    
    p_zxp_swizzleMethodOfSelf([self class], @selector(reloadData), @selector(p_zxp_swizzleReloadData));
    p_zxp_swizzleMethodOfSelf([self class],@selector(reloadRowsAtIndexPaths:withRowAnimation:),@selector(p_zxp_swizzleReloadRowsAtIndexPaths:withRowAnimation:));
    p_zxp_swizzleMethodOfSelf([self class],@selector(reloadSections:withRowAnimation:),@selector(p_zxp_swizzleReloadSections:withRowAnimation:));
    p_zxp_swizzleMethodOfSelf([self class],@selector(deleteSections:withRowAnimation:),@selector(p_zxp_swizzleDeleteSections:withRowAnimation:));
    p_zxp_swizzleMethodOfSelf([self class],@selector(deleteRowsAtIndexPaths:withRowAnimation:),@selector(p_zxp_swizzleDeleteRowsAtIndexPaths:withRowAnimation:));
}

#pragma mark - category UITableView + ZXPCellAutoHeight -> public apis

- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath {
    return [self p_zxp_heightWithIndexPath:indexPath handle:^CGFloat(UITableViewCell *cell, NSIndexPath *indexPath) {
        NSMutableArray *maxYArray = [NSMutableArray array];
        [cell.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            if (!obj.hidden) {
                [maxYArray addObject:@(CGRectGetMaxY(obj.frame))];
            }
        }];
        
        NSArray *compareMaxYArray = [maxYArray sortedArrayUsingSelector:@selector(compare:)];
        return [compareMaxYArray.lastObject floatValue];
    }];
}

- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath space:(CGFloat)space {
    return [self zxp_cellHeightWithindexPath:indexPath] + space;
}

- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath bottomView:(UIView *(^)(__kindof UITableViewCell *cell))block {
    return [self p_zxp_heightWithIndexPath:indexPath handle:^CGFloat(UITableViewCell *cell, NSIndexPath *indexPath) {
        if (!block) {
            return [self zxp_cellHeightWithindexPath:indexPath];
        }
        
        UIView *bottomView = block(cell);
        return CGRectGetMaxY(bottomView.frame);
    }];
}

- (CGFloat)zxp_cellHeightWithindexPath:(NSIndexPath *)indexPath bottomView:(UIView *(^)(__kindof UITableViewCell *cell))block space:(CGFloat)space {
    return [self zxp_cellHeightWithindexPath:indexPath bottomView:block] + space;
}

#pragma mark - private

- (CGFloat)p_zxp_heightWithIndexPath:(NSIndexPath *)indexPath handle:(CGFloat(^)(UITableViewCell *cell,NSIndexPath *indexPath))block {
    
    NSMutableDictionary *heightDictionary = [self p_zxp_heightDictionary];
    NSString *dictionaryKey = p_zxp_heightDictionaryKey(indexPath);
    CGFloat cacheHeight = [heightDictionary[dictionaryKey] floatValue];
    
    if (!cacheHeight) {
        UITableViewCell *cell = [self p_zxp_cellWithIndexPath:indexPath];
        
        CGFloat height = block(cell,indexPath);
        
        cacheHeight = !height ? CGFLOAT_MIN : height;
        [heightDictionary setObject:@(cacheHeight) forKey:dictionaryKey];
        
    }
    
    return cacheHeight;
}

- (NSMutableDictionary *)p_zxp_heightDictionary {
    NSMutableDictionary *heightDictionary = objc_getAssociatedObject(self, &kZXPTableViewCellHeightDictionary);
    if (!heightDictionary) {
        heightDictionary = [NSMutableDictionary dictionary];
        objc_setAssociatedObject(self, &kZXPTableViewCellHeightDictionary, heightDictionary, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    return heightDictionary;
}

- (UITableViewCell *)p_zxp_cellWithIndexPath:(NSIndexPath *)indexPath {
    id dataSourceObj = self.dataSource;
    
    NSAssert([dataSourceObj respondsToSelector:@selector(tableView:cellForRowAtIndexPath:)], @"请实现 tableView:cellForRowAtIndexPath: 方法");
    
    UIWindow *window = [[UIApplication sharedApplication].delegate window];
    [window layoutIfNeeded];
    
    UITableViewCell *cell = [dataSourceObj tableView:self cellForRowAtIndexPath:indexPath];
    
    CGRect cellFrame = cell.frame;
    cellFrame.size.width = CGRectGetWidth(self.frame);
    cell.frame = cellFrame;
    
    [cell layoutIfNeeded];
    
    return cell;
}

#pragma mark swizzle method

- (void)p_zxp_swizzleReloadData {
    if ([self p_zxp_heightDictionary].count) {
        [[self p_zxp_heightDictionary] removeAllObjects];
    }
    [self p_zxp_swizzleReloadData];
}

- (void)p_zxp_swizzleReloadRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
    
    if ([self p_zxp_heightDictionary].count) {
        [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            [[self p_zxp_heightDictionary] removeObjectForKey:p_zxp_heightDictionaryKey(obj)];
        }];
    }
    
    [self p_zxp_swizzleReloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];
    
}

- (void)p_zxp_swizzleReloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
    
    if ([self p_zxp_heightDictionary].count) {
        NSMutableArray *tempArray = [NSMutableArray array];
        
        [sections enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
            NSUInteger section = idx;
            [[[self p_zxp_heightDictionary] allKeys] enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                NSString *sectionString = [obj componentsSeparatedByString:@"-"].firstObject;
                
                if (section == [sectionString longLongValue]) {
                    [tempArray addObject:obj];
                }
                
            }];
        }];
        
        [[self p_zxp_heightDictionary] removeObjectsForKeys:tempArray];
    }
    
    [self p_zxp_swizzleReloadSections:sections withRowAnimation:animation];
    
}

- (void)p_zxp_swizzleDeleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
    if ([self p_zxp_heightDictionary].count) {
        [[self p_zxp_heightDictionary] removeAllObjects];
    }
    [self p_zxp_swizzleDeleteSections:sections withRowAnimation:animation];
}

- (void)p_zxp_swizzleDeleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
    if ([self p_zxp_heightDictionary].count) {
        [[self p_zxp_heightDictionary] removeAllObjects];
    }
    [self p_zxp_swizzleDeleteRowsAtIndexPaths:indexPaths withRowAnimation:animation];
}

#pragma mark - private -> c

NSString *p_zxp_heightDictionaryKey(NSIndexPath *indexPath) {
    return [NSString stringWithFormat:@"%zi-%zi",indexPath.section,indexPath.row];
}

void p_zxp_swizzleMethodOfSelf(Class aClass,SEL sel1,SEL sel2) {
    method_exchangeImplementations(class_getInstanceMethod(aClass, sel1), class_getInstanceMethod(aClass, sel2));
}

@end

//-----------------------------------------------------

@implementation ZXPAutoLayoutFactory

- (ZXPAutoLayoutFactory *(^)(UILayoutPriority))priority {
    return ^(UILayoutPriority priority) {
        self.layoutPriority          = priority;
        return self;
    };
}

- (ZXPAutoLayoutFactory *(^)(CGFloat))multiplier {
    return ^(CGFloat multiplier) {
        self.layoutMultiplierValue = multiplier;
        return self;
    };
}

- (CGFloat)layoutMultiplierValue {
    return _layoutMultiplierValue == 0 ? 1 : _layoutMultiplierValue;
}

+ (void)p_layoutMakerLockWithBlock:(void (^)(void))block {
    objc_setAssociatedObject(kZXPAutoLayoutForArrayForLockObject, kZXPAutoLayoutForArrayForLockKey, @(YES), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    if (block) {
        block();
    }
    objc_setAssociatedObject(kZXPAutoLayoutForArrayForLockObject, kZXPAutoLayoutForArrayForLockKey, nil, OBJC_ASSOCIATION_ASSIGN);
}

@end

#pragma mark - 生产 zxp_layout 的C函数

#pragma mark 私有
__attribute__((__overloadable__)) ZXPAutoLayoutFactory * p_zxp_layout_maker(UIView *secondView,CGFloat constant,NSLayoutAttribute firstAttribute,NSLayoutAttribute secondAttribute) {
    id lockLayout = objc_getAssociatedObject(kZXPAutoLayoutForArrayForLockObject, kZXPAutoLayoutForArrayForLockKey);
    if (!lockLayout) {
        return nil;
    }
    ZXPAutoLayoutMaker *layout = [[ZXPAutoLayoutMaker alloc] initWithView:nil type:kZXPAutoLayoutMakerAdd];
    ZXPAutoLayoutFactory *factory = [ZXPAutoLayoutFactory new];
    factory.layoutConstant = constant;
    factory.layoutFirstAttribute = firstAttribute;
    factory.layoutSecondView = secondView;
    factory.layoutSecondAttribute = secondAttribute;
    factory.marker = layout;
    
    NSMutableArray<ZXPAutoLayoutFactory *> *array = objc_getAssociatedObject(kZXPAutoLayoutForArrayObject, kZXPAutoLayoutForArrayKey);
    if (array == nil) {
        array = [NSMutableArray array];
        objc_setAssociatedObject(kZXPAutoLayoutForArrayObject, &kZXPAutoLayoutForArrayKey, array, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    [array addObject:factory];
    return factory;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * p_zxp_layout_maker(UIView *secondView,CGFloat constant,NSLayoutAttribute attribute) {
    return p_zxp_layout_maker(secondView, constant, attribute,NSLayoutAttributeNotAnAttribute);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * p_zxp_layout_maker(CGFloat constant,NSLayoutAttribute attribute) {
    return p_zxp_layout_maker(nil, constant, attribute);
}

#pragma mark 公开

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_top(CGFloat constant) {
    return p_zxp_layout_maker(constant,NSLayoutAttributeTop);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_left(CGFloat constant) {
    return p_zxp_layout_maker(constant,NSLayoutAttributeLeft);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_right(CGFloat constant) {
    return p_zxp_layout_maker(constant,NSLayoutAttributeRight);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottom(CGFloat constant) {
    return p_zxp_layout_maker(constant,NSLayoutAttributeBottom);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_width(CGFloat constant) {
    return p_zxp_layout_maker(constant, NSLayoutAttributeWidth);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_height(CGFloat constant) {
    return p_zxp_layout_maker(constant, NSLayoutAttributeHeight);
}

ZXPAutoLayoutFactory * zxp_layout_edge(UIEdgeInsets insets) {
    ZXPAutoLayoutFactory *layout = p_zxp_layout_maker(0, NSLayoutAttributeNotAnAttribute);
    layout.layoutInsets = @[
                            zxp_layout_top(insets.top),
                            zxp_layout_left(insets.left),
                            zxp_layout_right(insets.right),
                            zxp_layout_bottom(insets.bottom)
                            ];
    return layout;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_top(void) {
    return zxp_layout_top(0.f);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_left(void) {
    return zxp_layout_left(0.f);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_right(void) {
    return zxp_layout_right(0.f);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottom(void) {
    return zxp_layout_bottom(0.f);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_width(void) {
    return zxp_layout_width(0.f);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_height(void) {
    return zxp_layout_height(0.f);
}

ZXPAutoLayoutFactory * zxp_layout_widthGreaterThanOrEqual(CGFloat constant) {
    ZXPAutoLayoutFactory *layout = p_zxp_layout_maker(constant, NSLayoutAttributeNotAnAttribute);
    layout.layoutAutoWidth = YES;
    return layout;
}

ZXPAutoLayoutFactory * zxp_layout_heightGreaterThanOrEqual(CGFloat constant) {
    ZXPAutoLayoutFactory *layout = p_zxp_layout_maker(constant, NSLayoutAttributeNotAnAttribute);
    layout.layoutAutoHeight = YES;
    return layout;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_center(UIView *secondView,CGFloat constant) {
    ZXPAutoLayoutFactory *factory = [ZXPAutoLayoutFactory new];
    factory.layoutCenters = @[
                              zxp_layout_centerX(secondView, constant),
                              zxp_layout_centerY(secondView, constant)
                              ];
    return factory;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_center(UIView *secondView) {
    return zxp_layout_center(secondView,0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_centerX(UIView *secondView,CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeCenterX, NSLayoutAttributeCenterX);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_centerX(UIView *secondView) {
    return zxp_layout_centerX(secondView,0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_centerY(UIView *secondView,CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeCenterY, NSLayoutAttributeCenterY);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_centerY(UIView *secondView) {
    return zxp_layout_centerY(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_topEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeTop);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_topEqualTo(UIView *secondView) {
    return zxp_layout_topEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_leftEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeLeft);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_leftEqualTo(UIView *secondView) {
    return zxp_layout_leftEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottomEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeBottom);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottomEqualTo(UIView *secondView) {
    return zxp_layout_bottomEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_rightEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeRight);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_rightEqualTo(UIView *secondView) {
    return zxp_layout_rightEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_widthEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeWidth);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_widthEqualTo(UIView *secondView) {
    return zxp_layout_widthEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_heightEqualTo(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeHeight);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_heightEqualTo(UIView *secondView) {
    return zxp_layout_heightEqualTo(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_widthEqualToHeight(UIView *secondView, CGFloat constant) {
    ZXPAutoLayoutFactory *factory = p_zxp_layout_maker(secondView, constant, NSLayoutAttributeNotAnAttribute);
    factory.widthEqualToHeight = YES;
    return factory;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_widthEqualToHeight(UIView *secondView) {
    return zxp_layout_widthEqualToHeight(secondView,0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_heightEqualToWidth(UIView *secondView, CGFloat constant) {
    ZXPAutoLayoutFactory *factory = p_zxp_layout_maker(secondView, constant, NSLayoutAttributeNotAnAttribute);
    factory.heightEqualToWidth = YES;
    return factory;
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_heightEqualToWidth(UIView *secondView) {
    return zxp_layout_heightEqualToWidth(secondView,0);
}

#pragma mark 某一边距参照某一个view来设置

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_topByView(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeTop,NSLayoutAttributeBottom);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_topByView(UIView *secondView) {
    return zxp_layout_topByView(secondView,0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_leftByView(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeLeft, NSLayoutAttributeRight);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_leftByView(UIView *secondView) {
    return zxp_layout_leftByView(secondView, 0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottomByView(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeBottom, NSLayoutAttributeTop);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_bottomByView(UIView *secondView) {
    return zxp_layout_bottomByView(secondView,0);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_rightByView(UIView *secondView, CGFloat constant) {
    return p_zxp_layout_maker(secondView, constant, NSLayoutAttributeRight, NSLayoutAttributeLeft);
}

__attribute__((__overloadable__)) ZXPAutoLayoutFactory * zxp_layout_rightByView(UIView *secondView) {
    return zxp_layout_rightByView(secondView,0);
}

#pragma mark - end 生产 zxp_layout 的C函数s





================================================
FILE: ZXPAutoLayout.podspec
================================================
Pod::Spec.new do |s|
  s.name         = "ZXPAutoLayout"  #名字
  s.version      = "2.0.1"  #版本号
  s.summary      = "ZXPAutoLayout" #简短的介绍
  s.homepage     = "https://github.com/biggercoffee/ZXPAutoLayout"   #主页,这里要填写可以访问到的地址,不然验证不通过
  s.license      = "MIT"  #开源协议
  s.author             = { "xiaoping" => "z_xiaoping@163.com" }  #作者信息
  s.social_media_url   = "http://blog.csdn.net/biggercoffee"    #多媒体介绍地址
  s.platform     = :ios, "7.0"    #支持平台及版本
  s.source       = { :git => "https://github.com/biggercoffee/ZXPAutoLayout.git", :tag => s.version }    #项目地址,这里不支持ssh的地址,验证不通过,只支持HTTP和HTTPS,最好使用HTTPS,
  s.source_files  = "ZXPAutoLayout/*" #代码源文件地址,**/*表示Classes目录及其子目录下所有文件,如果有多个目录下则用逗号分开,如果需要在项目中分组显示,这里也要做相应的设置
  s.requires_arc = true   #项目是否使用 ARC
end

================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/AppDelegate.h
================================================
//
//  AppDelegate.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end



================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/AppDelegate.m
================================================
//
//  AppDelegate.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "iphone",
      "size" : "29x29",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "29x29",
      "scale" : "3x"
    },
    {
      "idiom" : "iphone",
      "size" : "40x40",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "40x40",
      "scale" : "3x"
    },
    {
      "idiom" : "iphone",
      "size" : "60x60",
      "scale" : "2x"
    },
    {
      "idiom" : "iphone",
      "size" : "60x60",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Assets.xcassets/Contents.json
================================================
{
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Base.lproj/LaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="EHf-IW-A2E">
            <objects>
                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
                        <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
                        <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <animations/>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="53" y="375"/>
        </scene>
    </scenes>
</document>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Base.lproj/Main.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="tne-QT-ifu">
            <objects>
                <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
                        <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                        <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <subviews>
                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="grf-TY-Ang">
                                <rect key="frame" x="0.0" y="20" width="600" height="580"/>
                                <animations/>
                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                <connections>
                                    <outlet property="dataSource" destination="BYZ-38-t0r" id="N28-ao-Jpf"/>
                                    <outlet property="delegate" destination="BYZ-38-t0r" id="DKs-9u-2Pr"/>
                                </connections>
                            </tableView>
                        </subviews>
                        <animations/>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                        <constraints>
                            <constraint firstItem="grf-TY-Ang" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="3x8-6q-kI2"/>
                            <constraint firstItem="grf-TY-Ang" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="4Yj-Ne-nWS"/>
                            <constraint firstAttribute="trailing" secondItem="grf-TY-Ang" secondAttribute="trailing" id="qOU-ZS-LAs"/>
                            <constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="grf-TY-Ang" secondAttribute="bottom" id="xD1-Wg-YRY"/>
                        </constraints>
                    </view>
                    <connections>
                        <outlet property="tableView" destination="grf-TY-Ang" id="ShF-Of-Aul"/>
                    </connections>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
            </objects>
        </scene>
    </scenes>
</document>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
</dict>
</plist>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/SimpleViewController.h
================================================
//
//  SimpleViewController.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SimpleViewController : UIViewController

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/SimpleViewController.m
================================================
//
//  SimpleViewController.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "SimpleViewController.h"
#import "ZXPAutoLayout.h"

@interface SimpleViewController ()

@end

@implementation SimpleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
}


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    //------------- 简单使用示例的用法 --------------
    
    
    /*
     一些基本操作示例
     */
    
    //设置一个背景为半透明红色的view,上下左右四边都距离superview的距离为10
    UIView *bgView = [UIView new];
    [self.view addSubview:bgView];
    bgView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:.5];
    [bgView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        //上下左右四边都距离superview的距离为10
        layout.edgeInsets(UIEdgeInsetsMake(10, 10, 10, 10));
        
        //也可以如下这行代码来设置,但要同时设置top,left,bottom,right.推荐以上写法,比较简洁.
        //layout.topSpace(10).leftSpace(10).bottomSpace(10).rightSpace(10);
    }];
    
    //蓝色view , 设置在superview里的距离和设置自身的宽高
    UIView *blueView = [UIView new];
    [bgView addSubview:blueView];
    blueView.backgroundColor = [UIColor blueColor];
    [blueView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.topSpace(20); //设置在superview里的上边距
        layout.leftSpace(20); //设置在superview里的左边距
        layout.rightSpace(20); //设置在superview里的右边距
        layout.heightValue(100); //设置高度
        // 注意:
        // 1.设置了左边距和右边距, 会自动拉升宽度,所以如上代码并没有设置宽度.
        // 2.如上代码可以写成一行,比如layout.topSpace(20).leftSpace(20)
        // 3.但是不推荐全部写在一行, 阅读性太差 , 而且在一行代码里写了诸多属性也不利于DEBUG
    }];
    
    //灰色view , 设置参照于其他view的距离和等宽等距离属性
    UIView *grayView = [UIView new];
    [bgView addSubview:grayView];
    grayView.backgroundColor = [UIColor grayColor];
    [grayView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        /*
         上边距参照blueview, 并加10的距离.
         意思就是说上边距在blueView的下边,并加上10的间距.
         如果只是想在blueview的下边没有距离的话, 第二个参数写为0即可
         */
        layout.topSpaceByView(blueView,10);
        
        /*
         左边距等同于blueView的左边距
         第二个参数是距离的值, 如果为0就代表左边距和blueview相等
         如果不为0,则先相等于blueview的距离,然后在加上第二参数的距离
         */
        layout.leftSpaceEqualTo(blueView,0);
        
        /*
         宽度等同于bluewView
         multiplier是倍数, 可选属性,如果不写此属性宽度就是等同于blueview
         如果写了此属性,如下示例, 则宽度等同于blueview的 0.5 倍
         */
        layout.widthEqualTo(blueView,0).multiplier(0.5);
        layout.heightValue(40); //设置高度
    }];
    
    //居中操作
    UIView *greenView = [UIView new];
    [bgView addSubview:greenView];
    greenView.backgroundColor = [UIColor greenColor];
    [greenView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.widthValue(40).heightValue(40); //设置宽高
        //在superview里保持居中
        layout.centerByView(greenView.superview,0);
        
        //如果要在blueview里保持居中写成如下即可.
        //注意如下代码打开的话,请把以上居中代码给注释掉,不然会有约束冲突
        //layout.centerByView(blueView);
        
        /*
         也可以单独的设置水平或者垂直居中
         */
        //在superview里水平居中
        //        layout.xCenterByView(greenView.superview);
        //在superview里垂直居中
        //        layout.yCenterByView(greenView.superview);
    }];
    
    //UILabel 的文字自适应
    UILabel *label = [UILabel new];
    [self.view addSubview:label];
    label.backgroundColor = [UIColor purpleColor];
    label.textColor = [UIColor whiteColor];
    label.text = @"这是文字自适应, 这是文字自适应 ,这是文字自适应 .这是文字自适应";
    [label zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        //设置上边距在grayView的下边,并且加10的距离
        layout.leftSpaceEqualTo(grayView,50.0);
        
        layout.bottomSpace(20); //设置在superview里的下边距
        
        layout.widthValue(100);//设置宽度
        
        layout.autoHeight(); //自适应高度,只针对UILabel有效
    }];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:btn];
    [btn setTitle:@"dismiss" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [btn zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.topSpace(20);
        layout.rightSpace(20);
        layout.widthValue(100);
        layout.heightValue(40);
    }];
    
}

- (void)buttonClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.h
================================================
//
//  TableViewController.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TableViewController : UIViewController

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.m
================================================
//
//  TableViewController.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "TableViewController.h"
#import "TestTableViewCell.h"
#import "ZXPAutoLayout.h"

static NSString * const kTestCellID = @"kTestCellID";
@interface TableViewController () <UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong,nonatomic) NSMutableArray<NSString *> *dataSource;

@end

@implementation TableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    for (int i = 0; i < 20; i ++) {
        
        NSMutableString *string = [NSMutableString stringWithFormat:@"%zi ",i];
        NSInteger length = arc4random() % 30 + 1;
        
        for (int j=0; j<length; j++) {
            [string appendString:@"string "];
        }
        [string appendFormat:@"%zi",i];
        [self.dataSource addObject:[string description]];
    }

    //register cells
    [self registerCells];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:btn];
    [btn setTitle:@"dismiss" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [btn zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.topSpace(20);
        layout.rightSpace(20);
        layout.widthValue(100);
        layout.heightValue(40);
    }];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - events

- (void)buttonClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - tableview

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataSource.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [tableView zxp_cellHeightWithindexPath:indexPath space:10];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TestTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kTestCellID];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [self configTestCell:cell indexPath:indexPath];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    [self dismissViewControllerAnimated:YES completion:nil];
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        [self.dataSource removeObjectAtIndex:indexPath.row];
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    }
}

#pragma mark - getter

- (NSMutableArray<NSString *> *)dataSource {
    if (!_dataSource) {
        _dataSource = [NSMutableArray array];
    }
    return _dataSource;
}

#pragma mark - private

- (void)registerCells {
    [self.tableView registerNib:[UINib nibWithNibName:[[TestTableViewCell class] description] bundle:nil] forCellReuseIdentifier:kTestCellID];
}

- (void)configTestCell:(TestTableViewCell *)cell indexPath:(NSIndexPath *)indexPath {
    cell.testLabel.text = self.dataSource[indexPath.row];
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.xib
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TableViewController">
            <connections>
                <outlet property="tableView" destination="ioX-Jo-AT6" id="f9c-Dr-iTQ"/>
                <outlet property="view" destination="iN0-l3-epB" id="Etg-84-Jua"/>
            </connections>
        </placeholder>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view contentMode="scaleToFill" id="iN0-l3-epB">
            <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
            <subviews>
                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ioX-Jo-AT6">
                    <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                    <animations/>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                    <connections>
                        <outlet property="dataSource" destination="-1" id="Vpi-bD-p7Q"/>
                        <outlet property="delegate" destination="-1" id="0QG-dB-j13"/>
                    </connections>
                </tableView>
            </subviews>
            <animations/>
            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
            <constraints>
                <constraint firstItem="ioX-Jo-AT6" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ESP-Zf-LcS"/>
                <constraint firstAttribute="trailing" secondItem="ioX-Jo-AT6" secondAttribute="trailing" id="FCr-X6-GWc"/>
                <constraint firstAttribute="bottom" secondItem="ioX-Jo-AT6" secondAttribute="bottom" id="mYW-5V-EXL"/>
                <constraint firstItem="ioX-Jo-AT6" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="t21-ns-hAO"/>
            </constraints>
        </view>
    </objects>
</document>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.h
================================================
//
//  TestTableViewCell.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TestTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *testView;
@property (weak, nonatomic) IBOutlet UILabel *testLabel;

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.m
================================================
//
//  TestTableViewCell.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "TestTableViewCell.h"

@implementation TestTableViewCell

- (void)awakeFromNib {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.xib
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="161" id="KGk-i7-Jjw" customClass="TestTableViewCell">
            <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
                <rect key="frame" x="0.0" y="0.0" width="320" height="160"/>
                <autoresizingMask key="autoresizingMask"/>
                <subviews>
                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RZu-QV-lzg">
                        <rect key="frame" x="10" y="10" width="300" height="40"/>
                        <animations/>
                        <color key="backgroundColor" red="0.0" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                        <constraints>
                            <constraint firstAttribute="height" constant="40" id="lm2-Sn-qok"/>
                        </constraints>
                    </view>
                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jFQ-FS-Bfd">
                        <rect key="frame" x="15" y="55" width="290" height="21"/>
                        <animations/>
                        <constraints>
                            <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="21" id="HCj-O1-k4A"/>
                        </constraints>
                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
                        <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                        <nil key="highlightedColor"/>
                    </label>
                </subviews>
                <animations/>
                <constraints>
                    <constraint firstItem="jFQ-FS-Bfd" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="3m9-dO-hSD"/>
                    <constraint firstItem="RZu-QV-lzg" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="Guk-tk-LGY"/>
                    <constraint firstAttribute="trailing" secondItem="jFQ-FS-Bfd" secondAttribute="trailing" constant="15" id="hRS-41-HW8"/>
                    <constraint firstItem="jFQ-FS-Bfd" firstAttribute="top" secondItem="RZu-QV-lzg" secondAttribute="bottom" constant="5" id="muQ-gf-doc"/>
                    <constraint firstItem="RZu-QV-lzg" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="rHd-uJ-Wf7"/>
                    <constraint firstAttribute="trailing" secondItem="RZu-QV-lzg" secondAttribute="trailing" constant="10" id="txv-y2-rAE"/>
                </constraints>
            </tableViewCellContentView>
            <animations/>
            <connections>
                <outlet property="testLabel" destination="jFQ-FS-Bfd" id="5GE-wb-aZF"/>
                <outlet property="testView" destination="RZu-QV-lzg" id="CvL-dz-sBi"/>
            </connections>
            <point key="canvasLocation" x="414" y="437.5"/>
        </tableViewCell>
    </objects>
</document>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ViewController.h
================================================
//
//  ViewController.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


@end



================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ViewController.m
================================================
//
//  ViewController.m
//  ZXPAutoLayoutDemo
//
/*
     support : Xcode7.0以上 , iOS 7 以上
     简洁方便的autolayout,有任何问题欢迎issue 我
     github : https://github.com/biggercoffee/ZXPAutolayout
     csdn blog : http://blog.csdn.net/biggercoffee
     QQ : 974792506
 
 */
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "ViewController.h"
#import "ZXPAutoLayout.h"
#import "SimpleViewController.h"
#import "ZXPStackViewController.h"
#import "TableViewController.h"
static NSString * const kCellIdentifier = @"identifier";
@interface ViewController () <UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@property (strong,nonatomic) NSMutableArray<NSString *> *dataSource;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    /*
      ***************** ***************** ***************** *****************
     
     support : Xcode7.0以上 , iOS 7 以上
     简洁方便的autolayout, 打造天朝最优, 最简洁方便, 最容易上手的autolayout
     有任何问题或者需要改善交流的 可在 csdn博客或者github里给我提问题也可以联系我本人QQ
     github : https://github.com/biggercoffee/ZXPAutolayout
     csdn blog : http://blog.csdn.net/biggercoffee
     QQ : 974792506
     Email: z_xiaoping@163.com
     
      ***************** ***************** ***************** *****************
    */
    
    [self.dataSource addObject:@"简单使用示例"];
    [self.dataSource addObject:@"ZXPStackView使用示例"];
    [self.dataSource addObject:@"cell 自适应"];
    
    [self registerCells];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - tableview

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];
    cell.textLabel.text = self.dataSource[indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSInteger row = indexPath.row;
    UIViewController *vc = nil;
    if (row == 0) {
        vc = [SimpleViewController new];
    }
    else if (row == 1) {
        vc = [ZXPStackViewController new];
    }
    else {
        vc = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil];
    }
    [self presentViewController:vc animated:YES completion:nil];
}

#pragma mark - getter 

- (NSMutableArray *)dataSource {
    if (!_dataSource) {
        _dataSource = [NSMutableArray array];
    }
    return _dataSource;
}

#pragma mark - private

- (void)registerCells {
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellIdentifier];
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ZXPStackViewController.h
================================================
//
//  ZXPStackViewController.h
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ZXPStackViewController : UIViewController

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ZXPStackViewController.m
================================================
//
//  ZXPStackViewController.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/12/13.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import "ZXPStackViewController.h"
#import "ZXPAutoLayout.h"

@interface ZXPStackViewController ()

@end

@implementation ZXPStackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    //传统的等宽, 水平对齐
    {/*
      UIView *view1 = [UIView new];
      [self.view addSubview:view1];
      view1.backgroundColor = [UIColor blueColor];
      
      UIView *view2 = [UIView new];
      [self.view addSubview:view2];
      view2.backgroundColor = [UIColor blackColor];
      
      UIView *view3 = [UIView new];
      [self.view addSubview:view3];
      view3.backgroundColor = [UIColor blueColor];
      
      [view1 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
      layout.topSpaceByView(grayView,10);
      layout.leftSpace(20);
      layout.heightValue(40);
      layout.widthEqualTo(view2);
      }];
      
      [view2 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
      layout.topSpaceEqualTo(view1,0);
      layout.leftSpaceByView(view1,20);
      layout.heightValue(40);
      layout.widthEqualTo(view3);
      }];
      
      [view3 zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
      layout.topSpaceEqualTo(view1,0);
      layout.leftSpaceByView(view2,20);
      layout.rightSpace(20);
      layout.heightValue(40);
      }];
      */
    }
    
    //等宽, 水平对齐
    // ZXPStackView 的使用
    {
        ZXPStackView *stackView = [ZXPStackView new];
        [self.view addSubview:stackView];
        stackView.backgroundColor = [UIColor blackColor];
        
        //只需要设置stackView的宽高和位置即可
        [stackView zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
            layout.topSpace(100);
            layout.leftSpace(0);
            layout.rightSpace(0);
            layout.heightValue(100);
        }];
        
        UIView *view1 = [UIView new];
        [stackView addSubview:view1];
        view1.backgroundColor = [UIColor blueColor];
        
        UIView *view2 = [UIView new];
        [stackView addSubview:view2];
        view2.backgroundColor = [UIColor yellowColor];
        
        UIView *view3 = [UIView new];
        [stackView addSubview:view3];
        view3.backgroundColor = [UIColor redColor];
        
        //stack的内边距
        stackView.padding = UIEdgeInsetsMake(10, 10, 10,10);
        //view直接的距离
        stackView.space = 10;
        
        /*
            调用此方法会给subviews自动添加约束条件,进行等宽或者等高排列
            type如果指定为 ZXPStackViewTypeVertical 就是垂直等高对齐了
         */
        [stackView layoutWithType:ZXPStackViewTypeHorizontal];
    }
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:btn];
    [btn setTitle:@"dismiss" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [btn zxp_addConstraints:^(ZXPAutoLayoutMaker *layout) {
        layout.topSpace(20);
        layout.rightSpace(20);
        layout.widthValue(100);
        layout.heightValue(40);
    }];
    
}

- (void)buttonClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/main.m
================================================
//
//  main.m
//  ZXPAutoLayoutDemo
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		1D72A4991C1D20F400A221AA /* SimpleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D72A4981C1D20F400A221AA /* SimpleViewController.m */; };
		1D72A49F1C1DABB900A221AA /* ZXPStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D72A49E1C1DABB900A221AA /* ZXPStackViewController.m */; };
		1D72A4A81C1DB4B700A221AA /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D72A4A71C1DB4B700A221AA /* TableViewController.m */; };
		1D72A4AC1C1DB72800A221AA /* TestTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D72A4AA1C1DB72800A221AA /* TestTableViewCell.m */; };
		1D72A4AD1C1DB72800A221AA /* TestTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D72A4AB1C1DB72800A221AA /* TestTableViewCell.xib */; };
		1D72A4AF1C1DB93B00A221AA /* TableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D72A4AE1C1DB93B00A221AA /* TableViewController.xib */; };
		1DD75F871BFB622800B4BEA9 /* ZXPAutoLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DD75F861BFB622800B4BEA9 /* ZXPAutoLayout.m */; };
		1DFBBF321BF7096E00459D22 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFBBF311BF7096E00459D22 /* main.m */; };
		1DFBBF351BF7096E00459D22 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFBBF341BF7096E00459D22 /* AppDelegate.m */; };
		1DFBBF381BF7096E00459D22 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFBBF371BF7096E00459D22 /* ViewController.m */; };
		1DFBBF3B1BF7096E00459D22 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1DFBBF391BF7096E00459D22 /* Main.storyboard */; };
		1DFBBF3D1BF7096E00459D22 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1DFBBF3C1BF7096E00459D22 /* Assets.xcassets */; };
		1DFBBF401BF7096E00459D22 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1DFBBF3E1BF7096E00459D22 /* LaunchScreen.storyboard */; };
		1DFBBF4B1BF7096E00459D22 /* ZXPAutoLayoutDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFBBF4A1BF7096E00459D22 /* ZXPAutoLayoutDemoTests.m */; };
		1DFBBF561BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFBBF551BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
		1DFBBF471BF7096E00459D22 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 1DFBBF251BF7096D00459D22 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 1DFBBF2C1BF7096E00459D22;
			remoteInfo = ZXPAutoLayoutDemo;
		};
		1DFBBF521BF7096E00459D22 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 1DFBBF251BF7096D00459D22 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 1DFBBF2C1BF7096E00459D22;
			remoteInfo = ZXPAutoLayoutDemo;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
		1D72A4971C1D20F400A221AA /* SimpleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleViewController.h; sourceTree = "<group>"; };
		1D72A4981C1D20F400A221AA /* SimpleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleViewController.m; sourceTree = "<group>"; };
		1D72A49D1C1DABB900A221AA /* ZXPStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZXPStackViewController.h; sourceTree = "<group>"; };
		1D72A49E1C1DABB900A221AA /* ZXPStackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZXPStackViewController.m; sourceTree = "<group>"; };
		1D72A4A61C1DB4B700A221AA /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = "<group>"; };
		1D72A4A71C1DB4B700A221AA /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = "<group>"; };
		1D72A4A91C1DB72800A221AA /* TestTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestTableViewCell.h; sourceTree = "<group>"; };
		1D72A4AA1C1DB72800A221AA /* TestTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestTableViewCell.m; sourceTree = "<group>"; };
		1D72A4AB1C1DB72800A221AA /* TestTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TestTableViewCell.xib; sourceTree = "<group>"; };
		1D72A4AE1C1DB93B00A221AA /* TableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableViewController.xib; sourceTree = "<group>"; };
		1DD75F851BFB622800B4BEA9 /* ZXPAutoLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZXPAutoLayout.h; sourceTree = "<group>"; };
		1DD75F861BFB622800B4BEA9 /* ZXPAutoLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZXPAutoLayout.m; sourceTree = "<group>"; };
		1DFBBF2D1BF7096E00459D22 /* ZXPAutoLayoutDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZXPAutoLayoutDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
		1DFBBF311BF7096E00459D22 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
		1DFBBF331BF7096E00459D22 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
		1DFBBF341BF7096E00459D22 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
		1DFBBF361BF7096E00459D22 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
		1DFBBF371BF7096E00459D22 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
		1DFBBF3A1BF7096E00459D22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
		1DFBBF3C1BF7096E00459D22 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		1DFBBF3F1BF7096E00459D22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
		1DFBBF411BF7096E00459D22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		1DFBBF461BF7096E00459D22 /* ZXPAutoLayoutDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZXPAutoLayoutDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		1DFBBF4A1BF7096E00459D22 /* ZXPAutoLayoutDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXPAutoLayoutDemoTests.m; sourceTree = "<group>"; };
		1DFBBF4C1BF7096E00459D22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		1DFBBF511BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZXPAutoLayoutDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		1DFBBF551BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXPAutoLayoutDemoUITests.m; sourceTree = "<group>"; };
		1DFBBF571BF7096E00459D22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		1DFBBF2A1BF7096E00459D22 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF431BF7096E00459D22 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF4E1BF7096E00459D22 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		1D72A4A01C1DADEC00A221AA /* Cells */ = {
			isa = PBXGroup;
			children = (
				1D72A4A91C1DB72800A221AA /* TestTableViewCell.h */,
				1D72A4AA1C1DB72800A221AA /* TestTableViewCell.m */,
				1D72A4AB1C1DB72800A221AA /* TestTableViewCell.xib */,
			);
			name = Cells;
			sourceTree = "<group>";
		};
		1DD75F841BFB622800B4BEA9 /* ZXPAutoLayout */ = {
			isa = PBXGroup;
			children = (
				1DD75F851BFB622800B4BEA9 /* ZXPAutoLayout.h */,
				1DD75F861BFB622800B4BEA9 /* ZXPAutoLayout.m */,
			);
			name = ZXPAutoLayout;
			path = ../../ZXPAutoLayout;
			sourceTree = "<group>";
		};
		1DFBBF241BF7096D00459D22 = {
			isa = PBXGroup;
			children = (
				1DFBBF2F1BF7096E00459D22 /* ZXPAutoLayoutDemo */,
				1DFBBF491BF7096E00459D22 /* ZXPAutoLayoutDemoTests */,
				1DFBBF541BF7096E00459D22 /* ZXPAutoLayoutDemoUITests */,
				1DFBBF2E1BF7096E00459D22 /* Products */,
			);
			sourceTree = "<group>";
		};
		1DFBBF2E1BF7096E00459D22 /* Products */ = {
			isa = PBXGroup;
			children = (
				1DFBBF2D1BF7096E00459D22 /* ZXPAutoLayoutDemo.app */,
				1DFBBF461BF7096E00459D22 /* ZXPAutoLayoutDemoTests.xctest */,
				1DFBBF511BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.xctest */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		1DFBBF2F1BF7096E00459D22 /* ZXPAutoLayoutDemo */ = {
			isa = PBXGroup;
			children = (
				1DD75F841BFB622800B4BEA9 /* ZXPAutoLayout */,
				1DFBBF331BF7096E00459D22 /* AppDelegate.h */,
				1DFBBF341BF7096E00459D22 /* AppDelegate.m */,
				1DFBBF361BF7096E00459D22 /* ViewController.h */,
				1DFBBF371BF7096E00459D22 /* ViewController.m */,
				1DFBBF391BF7096E00459D22 /* Main.storyboard */,
				1D72A4971C1D20F400A221AA /* SimpleViewController.h */,
				1D72A4981C1D20F400A221AA /* SimpleViewController.m */,
				1D72A49D1C1DABB900A221AA /* ZXPStackViewController.h */,
				1D72A49E1C1DABB900A221AA /* ZXPStackViewController.m */,
				1D72A4A61C1DB4B700A221AA /* TableViewController.h */,
				1D72A4A71C1DB4B700A221AA /* TableViewController.m */,
				1D72A4AE1C1DB93B00A221AA /* TableViewController.xib */,
				1D72A4A01C1DADEC00A221AA /* Cells */,
				1DFBBF3C1BF7096E00459D22 /* Assets.xcassets */,
				1DFBBF3E1BF7096E00459D22 /* LaunchScreen.storyboard */,
				1DFBBF411BF7096E00459D22 /* Info.plist */,
				1DFBBF301BF7096E00459D22 /* Supporting Files */,
			);
			path = ZXPAutoLayoutDemo;
			sourceTree = "<group>";
		};
		1DFBBF301BF7096E00459D22 /* Supporting Files */ = {
			isa = PBXGroup;
			children = (
				1DFBBF311BF7096E00459D22 /* main.m */,
			);
			name = "Supporting Files";
			sourceTree = "<group>";
		};
		1DFBBF491BF7096E00459D22 /* ZXPAutoLayoutDemoTests */ = {
			isa = PBXGroup;
			children = (
				1DFBBF4A1BF7096E00459D22 /* ZXPAutoLayoutDemoTests.m */,
				1DFBBF4C1BF7096E00459D22 /* Info.plist */,
			);
			path = ZXPAutoLayoutDemoTests;
			sourceTree = "<group>";
		};
		1DFBBF541BF7096E00459D22 /* ZXPAutoLayoutDemoUITests */ = {
			isa = PBXGroup;
			children = (
				1DFBBF551BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.m */,
				1DFBBF571BF7096E00459D22 /* Info.plist */,
			);
			path = ZXPAutoLayoutDemoUITests;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		1DFBBF2C1BF7096E00459D22 /* ZXPAutoLayoutDemo */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 1DFBBF5A1BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemo" */;
			buildPhases = (
				1DFBBF291BF7096E00459D22 /* Sources */,
				1DFBBF2A1BF7096E00459D22 /* Frameworks */,
				1DFBBF2B1BF7096E00459D22 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = ZXPAutoLayoutDemo;
			productName = ZXPAutoLayoutDemo;
			productReference = 1DFBBF2D1BF7096E00459D22 /* ZXPAutoLayoutDemo.app */;
			productType = "com.apple.product-type.application";
		};
		1DFBBF451BF7096E00459D22 /* ZXPAutoLayoutDemoTests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 1DFBBF5D1BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemoTests" */;
			buildPhases = (
				1DFBBF421BF7096E00459D22 /* Sources */,
				1DFBBF431BF7096E00459D22 /* Frameworks */,
				1DFBBF441BF7096E00459D22 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
				1DFBBF481BF7096E00459D22 /* PBXTargetDependency */,
			);
			name = ZXPAutoLayoutDemoTests;
			productName = ZXPAutoLayoutDemoTests;
			productReference = 1DFBBF461BF7096E00459D22 /* ZXPAutoLayoutDemoTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		1DFBBF501BF7096E00459D22 /* ZXPAutoLayoutDemoUITests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 1DFBBF601BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemoUITests" */;
			buildPhases = (
				1DFBBF4D1BF7096E00459D22 /* Sources */,
				1DFBBF4E1BF7096E00459D22 /* Frameworks */,
				1DFBBF4F1BF7096E00459D22 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
				1DFBBF531BF7096E00459D22 /* PBXTargetDependency */,
			);
			name = ZXPAutoLayoutDemoUITests;
			productName = ZXPAutoLayoutDemoUITests;
			productReference = 1DFBBF511BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.xctest */;
			productType = "com.apple.product-type.bundle.ui-testing";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		1DFBBF251BF7096D00459D22 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0710;
				ORGANIZATIONNAME = coffee;
				TargetAttributes = {
					1DFBBF2C1BF7096E00459D22 = {
						CreatedOnToolsVersion = 7.1.1;
					};
					1DFBBF451BF7096E00459D22 = {
						CreatedOnToolsVersion = 7.1.1;
						TestTargetID = 1DFBBF2C1BF7096E00459D22;
					};
					1DFBBF501BF7096E00459D22 = {
						CreatedOnToolsVersion = 7.1.1;
						TestTargetID = 1DFBBF2C1BF7096E00459D22;
					};
				};
			};
			buildConfigurationList = 1DFBBF281BF7096D00459D22 /* Build configuration list for PBXProject "ZXPAutoLayoutDemo" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = 1DFBBF241BF7096D00459D22;
			productRefGroup = 1DFBBF2E1BF7096E00459D22 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				1DFBBF2C1BF7096E00459D22 /* ZXPAutoLayoutDemo */,
				1DFBBF451BF7096E00459D22 /* ZXPAutoLayoutDemoTests */,
				1DFBBF501BF7096E00459D22 /* ZXPAutoLayoutDemoUITests */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		1DFBBF2B1BF7096E00459D22 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1DFBBF401BF7096E00459D22 /* LaunchScreen.storyboard in Resources */,
				1D72A4AD1C1DB72800A221AA /* TestTableViewCell.xib in Resources */,
				1DFBBF3D1BF7096E00459D22 /* Assets.xcassets in Resources */,
				1D72A4AF1C1DB93B00A221AA /* TableViewController.xib in Resources */,
				1DFBBF3B1BF7096E00459D22 /* Main.storyboard in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF441BF7096E00459D22 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF4F1BF7096E00459D22 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		1DFBBF291BF7096E00459D22 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1D72A49F1C1DABB900A221AA /* ZXPStackViewController.m in Sources */,
				1D72A4AC1C1DB72800A221AA /* TestTableViewCell.m in Sources */,
				1D72A4991C1D20F400A221AA /* SimpleViewController.m in Sources */,
				1DFBBF381BF7096E00459D22 /* ViewController.m in Sources */,
				1DFBBF351BF7096E00459D22 /* AppDelegate.m in Sources */,
				1DFBBF321BF7096E00459D22 /* main.m in Sources */,
				1DD75F871BFB622800B4BEA9 /* ZXPAutoLayout.m in Sources */,
				1D72A4A81C1DB4B700A221AA /* TableViewController.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF421BF7096E00459D22 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1DFBBF4B1BF7096E00459D22 /* ZXPAutoLayoutDemoTests.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		1DFBBF4D1BF7096E00459D22 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1DFBBF561BF7096E00459D22 /* ZXPAutoLayoutDemoUITests.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
		1DFBBF481BF7096E00459D22 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 1DFBBF2C1BF7096E00459D22 /* ZXPAutoLayoutDemo */;
			targetProxy = 1DFBBF471BF7096E00459D22 /* PBXContainerItemProxy */;
		};
		1DFBBF531BF7096E00459D22 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 1DFBBF2C1BF7096E00459D22 /* ZXPAutoLayoutDemo */;
			targetProxy = 1DFBBF521BF7096E00459D22 /* PBXContainerItemProxy */;
		};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
		1DFBBF391BF7096E00459D22 /* Main.storyboard */ = {
			isa = PBXVariantGroup;
			children = (
				1DFBBF3A1BF7096E00459D22 /* Base */,
			);
			name = Main.storyboard;
			sourceTree = "<group>";
		};
		1DFBBF3E1BF7096E00459D22 /* LaunchScreen.storyboard */ = {
			isa = PBXVariantGroup;
			children = (
				1DFBBF3F1BF7096E00459D22 /* Base */,
			);
			name = LaunchScreen.storyboard;
			sourceTree = "<group>";
		};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
		1DFBBF581BF7096E00459D22 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = iphoneos;
			};
			name = Debug;
		};
		1DFBBF591BF7096E00459D22 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = iphoneos;
				VALIDATE_PRODUCT = YES;
			};
			name = Release;
		};
		1DFBBF5B1BF7096E00459D22 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				INFOPLIST_FILE = ZXPAutoLayoutDemo/Info.plist;
				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemo;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		1DFBBF5C1BF7096E00459D22 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				INFOPLIST_FILE = ZXPAutoLayoutDemo/Info.plist;
				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemo;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
		1DFBBF5E1BF7096E00459D22 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				BUNDLE_LOADER = "$(TEST_HOST)";
				INFOPLIST_FILE = ZXPAutoLayoutDemoTests/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemoTests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZXPAutoLayoutDemo.app/ZXPAutoLayoutDemo";
			};
			name = Debug;
		};
		1DFBBF5F1BF7096E00459D22 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				BUNDLE_LOADER = "$(TEST_HOST)";
				INFOPLIST_FILE = ZXPAutoLayoutDemoTests/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemoTests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZXPAutoLayoutDemo.app/ZXPAutoLayoutDemo";
			};
			name = Release;
		};
		1DFBBF611BF7096E00459D22 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				INFOPLIST_FILE = ZXPAutoLayoutDemoUITests/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemoUITests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TEST_TARGET_NAME = ZXPAutoLayoutDemo;
				USES_XCTRUNNER = YES;
			};
			name = Debug;
		};
		1DFBBF621BF7096E00459D22 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				INFOPLIST_FILE = ZXPAutoLayoutDemoUITests/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.biggercoffee.zxp.tp.ZXPAutoLayoutDemoUITests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TEST_TARGET_NAME = ZXPAutoLayoutDemo;
				USES_XCTRUNNER = YES;
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		1DFBBF281BF7096D00459D22 /* Build configuration list for PBXProject "ZXPAutoLayoutDemo" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1DFBBF581BF7096E00459D22 /* Debug */,
				1DFBBF591BF7096E00459D22 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		1DFBBF5A1BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemo" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1DFBBF5B1BF7096E00459D22 /* Debug */,
				1DFBBF5C1BF7096E00459D22 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		1DFBBF5D1BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemoTests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1DFBBF5E1BF7096E00459D22 /* Debug */,
				1DFBBF5F1BF7096E00459D22 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		1DFBBF601BF7096E00459D22 /* Build configuration list for PBXNativeTarget "ZXPAutoLayoutDemoUITests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1DFBBF611BF7096E00459D22 /* Debug */,
				1DFBBF621BF7096E00459D22 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = 1DFBBF251BF7096D00459D22 /* Project object */;
}


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:ZXPAutoLayoutDemo.xcodeproj">
   </FileRef>
</Workspace>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemoTests/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
</dict>
</plist>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemoTests/ZXPAutoLayoutDemoTests.m
================================================
//
//  ZXPAutoLayoutDemoTests.m
//  ZXPAutoLayoutDemoTests
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <XCTest/XCTest.h>

@interface ZXPAutoLayoutDemoTests : XCTestCase

@end

@implementation ZXPAutoLayoutDemoTests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemoUITests/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
</dict>
</plist>


================================================
FILE: ZXPAutoLayoutDemo/ZXPAutoLayoutDemoUITests/ZXPAutoLayoutDemoUITests.m
================================================
//
//  ZXPAutoLayoutDemoUITests.m
//  ZXPAutoLayoutDemoUITests
//
//  Created by coffee on 15/11/14.
//  Copyright © 2015年 coffee. All rights reserved.
//

#import <XCTest/XCTest.h>

@interface ZXPAutoLayoutDemoUITests : XCTestCase

@end

@implementation ZXPAutoLayoutDemoUITests

- (void)setUp {
    [super setUp];
    
    // Put setup code here. This method is called before the invocation of each test method in the class.
    
    // In UI tests it is usually best to stop immediately when a failure occurs.
    self.continueAfterFailure = NO;
    // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
    [[[XCUIApplication alloc] init] launch];
    
    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // Use recording to get started writing UI tests.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
}

@end
Download .txt
gitextract_zbe98yoz/

├── .gitignore
├── LICENSE
├── README.md
├── ZXPAutoLayout/
│   ├── ZXPAutoLayout.h
│   └── ZXPAutoLayout.m
├── ZXPAutoLayout.podspec
└── ZXPAutoLayoutDemo/
    ├── ZXPAutoLayoutDemo/
    │   ├── AppDelegate.h
    │   ├── AppDelegate.m
    │   ├── Assets.xcassets/
    │   │   ├── AppIcon.appiconset/
    │   │   │   └── Contents.json
    │   │   └── Contents.json
    │   ├── Base.lproj/
    │   │   ├── LaunchScreen.storyboard
    │   │   └── Main.storyboard
    │   ├── Info.plist
    │   ├── SimpleViewController.h
    │   ├── SimpleViewController.m
    │   ├── TableViewController.h
    │   ├── TableViewController.m
    │   ├── TableViewController.xib
    │   ├── TestTableViewCell.h
    │   ├── TestTableViewCell.m
    │   ├── TestTableViewCell.xib
    │   ├── ViewController.h
    │   ├── ViewController.m
    │   ├── ZXPStackViewController.h
    │   ├── ZXPStackViewController.m
    │   └── main.m
    ├── ZXPAutoLayoutDemo.xcodeproj/
    │   ├── project.pbxproj
    │   └── project.xcworkspace/
    │       └── contents.xcworkspacedata
    ├── ZXPAutoLayoutDemoTests/
    │   ├── Info.plist
    │   └── ZXPAutoLayoutDemoTests.m
    └── ZXPAutoLayoutDemoUITests/
        ├── Info.plist
        └── ZXPAutoLayoutDemoUITests.m
Condensed preview — 32 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (168K chars).
[
  {
    "path": ".gitignore",
    "chars": 494,
    "preview": "# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!defau"
  },
  {
    "path": "LICENSE",
    "chars": 1068,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
  },
  {
    "path": "README.md",
    "chars": 9141,
    "preview": "# ZXPAutoLayout\n## 方便简洁的ios自动布局\n## 此处简单入门但也足以, 如需深入一点了解, 可以查看这篇博文, 详细讲解了ZXPAutoLayout的使用 : [http://www.jianshu.com/p/0ed"
  },
  {
    "path": "ZXPAutoLayout/ZXPAutoLayout.h",
    "chars": 18196,
    "preview": "\n/*\n \n ***************** ***************** ***************** *****************\n \n version : 2.0.1\n support : Xcode7.0以上 "
  },
  {
    "path": "ZXPAutoLayout/ZXPAutoLayout.m",
    "chars": 58561,
    "preview": "\n#import \"ZXPAutoLayout.h\"\n#import <objc/runtime.h>\n\n#pragma mark - NSLayoutAttribute convert string\n\nNSString* p_zxp_la"
  },
  {
    "path": "ZXPAutoLayout.podspec",
    "chars": 757,
    "preview": "Pod::Spec.new do |s|\n  s.name         = \"ZXPAutoLayout\"  #名字\n  s.version      = \"2.0.1\"  #版本号\n  s.summary      = \"ZXPAut"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/AppDelegate.h",
    "chars": 279,
    "preview": "//\n//  AppDelegate.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 2015年 coffee. All right"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/AppDelegate.m",
    "chars": 2033,
    "preview": "//\n//  AppDelegate.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 2015年 coffee. All right"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 585,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\""
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Assets.xcassets/Contents.json",
    "chars": 62,
    "preview": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Base.lproj/LaunchScreen.storyboard",
    "chars": 1664,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Base.lproj/Main.storyboard",
    "chars": 3434,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/Info.plist",
    "chars": 1205,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/SimpleViewController.h",
    "chars": 227,
    "preview": "//\n//  SimpleViewController.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. "
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/SimpleViewController.m",
    "chars": 4528,
    "preview": "//\n//  SimpleViewController.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. "
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.h",
    "chars": 225,
    "preview": "//\n//  TableViewController.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. A"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.m",
    "chars": 3770,
    "preview": "//\n//  TableViewController.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. A"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TableViewController.xib",
    "chars": 2723,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" versi"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.h",
    "chars": 332,
    "preview": "//\n//  TestTableViewCell.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. All"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.m",
    "chars": 410,
    "preview": "//\n//  TestTableViewCell.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee. All"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/TestTableViewCell.xib",
    "chars": 4301,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" versi"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ViewController.h",
    "chars": 217,
    "preview": "//\n//  ViewController.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 2015年 coffee. All ri"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ViewController.m",
    "chars": 3118,
    "preview": "//\n//  ViewController.m\n//  ZXPAutoLayoutDemo\n//\n/*\n     support : Xcode7.0以上 , iOS 7 以上\n     简洁方便的autolayout,有任何问题欢迎iss"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ZXPStackViewController.h",
    "chars": 231,
    "preview": "//\n//  ZXPStackViewController.h\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/ZXPStackViewController.m",
    "chars": 3559,
    "preview": "//\n//  ZXPStackViewController.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/12/13.\n//  Copyright © 2015年 coffee"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo/main.m",
    "chars": 336,
    "preview": "//\n//  main.m\n//  ZXPAutoLayoutDemo\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 2015年 coffee. All rights reser"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo.xcodeproj/project.pbxproj",
    "chars": 25856,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 162,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:ZXPAutoLayoutDe"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemoTests/Info.plist",
    "chars": 733,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemoTests/ZXPAutoLayoutDemoTests.m",
    "chars": 931,
    "preview": "//\n//  ZXPAutoLayoutDemoTests.m\n//  ZXPAutoLayoutDemoTests\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 2015年 c"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemoUITests/Info.plist",
    "chars": 733,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ZXPAutoLayoutDemo/ZXPAutoLayoutDemoUITests/ZXPAutoLayoutDemoUITests.m",
    "chars": 1238,
    "preview": "//\n//  ZXPAutoLayoutDemoUITests.m\n//  ZXPAutoLayoutDemoUITests\n//\n//  Created by coffee on 15/11/14.\n//  Copyright © 201"
  }
]

About this extraction

This page contains the full source code of the biggercoffee/ZXPAutoLayout GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 32 files (147.6 KB), approximately 42.1k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!