PureLayout主要对ALView(UIView for iOS/NSView for mac)、NSArray(可以是ALView或者NSLayoutConstraint)、NSLayoutConstraint进行扩展，核心是把自己的语法翻译成NSLayoutConstraint，然后addConstraint。除了翻译语法以外，还提供了autoInstall功能(声称Constraints当时可以不active)，并且还可以设置Priority（避免冲突）和Identifier（方便调试）。

Add -[configureForAutoLayout] for initialized view …
This new API method allows you to set translatesAutoresizingMaskIntoConstraints to NO with a chainable method call (as self is returned). It is convenient when you want to use a specific factory method or initializer, and configure the view for use with auto layout on the same line.
For example:
UIButton *button =[[UIButton buttonWithType:UIButtonTypeSystem] configureForAutoLayout];
Closes #75

##一个例子

使用UIScrollView，可以尝试一下，当屏幕旋转的时候，autolayout的威力就显示出来了。

# import "ALiOSDemo11ViewController.h"
# import <PureLayout/PureLayout.h>
@interfaceALiOSDemo11ViewController()@propertyUIScrollView*sv;@propertyUIImageView*avatar;@propertyUILabel*userName;@propertyUILabel*time;@propertyUILabel*mainImage;@propertyUILabel*vote;@propertyUIButton*voteBtn;@propertyUIButton*commentBtn;@propertyUIButton*actionBtn;@propertyNSLayoutConstraint*svHeight;@propertyUIView*wrapper;@end@interfaceUIView(XDView)-(void)addSubviews:(UIView*)view,...;@end@implementationUIView(XDView)-(void)addSubviews:(UIView*)view,...{//注意调用的时候，以nil结尾，否则引用出去了。
va_listargs;va_start(args,view);[selfaddSubview:view];UIView*v;while((v=va_arg(args,UIView*))){[selfaddSubview:v];}va_end(args);}@end@implementationALiOSDemo11ViewController@synthesizesv,avatar,userName,time,mainImage,vote,voteBtn,commentBtn,actionBtn,wrapper,svHeight;-(void)loadView{[superloadView];[self.viewaddSubview:sv=[UIScrollViewnewAutoLayoutView]];[svaddSubviews:avatar=[UIImageViewnewAutoLayoutView],userName=[UILabelnewAutoLayoutView],time=[UILabelnewAutoLayoutView],mainImage=[UILabelnewAutoLayoutView],vote=[UILabelnewAutoLayoutView],voteBtn=[UIButtonnewAutoLayoutView],commentBtn=[UIButtonnewAutoLayoutView],actionBtn=[UIButtonnewAutoLayoutView],nil];//with color
self.view.backgroundColor=[UIColorblueColor];sv.backgroundColor=[UIColoryellowColor];avatar.backgroundColor=[UIColorredColor];mainImage.backgroundColor=[UIColorredColor];userName.textColor=[UIColorblueColor];vote.textColor=[UIColorblueColor];time.textColor=[UIColorgrayColor];for(UIButton*btnin@[voteBtn,commentBtn,actionBtn]){btn.backgroundColor=[UIColorlightGrayColor];btn.layer.cornerRadius=2;[btnsetTitleColor:[UIColordarkGrayColor]forState:UIControlStateNormal];btn.contentEdgeInsets=UIEdgeInsetsMake(5,10,5,10);}//set size
[svautoPinEdgesToSuperviewEdgesWithInsets:ALEdgeInsetsZero];[svautoMatchDimension:ALDimensionWidthtoDimension:ALDimensionWidthofView:self.viewwithOffset:0];[avatarautoSetDimensionsToSize:CGSizeMake(32,32)];avatar.layer.cornerRadius=16;[avatarautoPinEdgeToSuperviewEdge:ALEdgeLeadingwithInset:15];[avatarautoPinEdgeToSuperviewEdge:ALEdgeTopwithInset:15];userName.text=@"Steve Jobs";[userNameautoPinEdge:ALEdgeLeadingtoEdge:ALEdgeTrailingofView:avatarwithOffset:10];time.text=@"7小时";[timeautoPinEdgeToSuperviewEdge:ALEdgeTrailingwithInset:15];[@[avatar,userName,time]autoAlignViewsToAxis:ALAxisHorizontal];mainImage.numberOfLines=0;mainImage.text=@"In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:In my example 'body' is a UITextView, but it could be anything else. If you happen to be using a UITextView as well note that in order for it to grow vertically it must have a height constraint that gets set in viewDidLayoutSubviews. So add the following constraint in viewDidLoad and keep a reference to it:";[mainImageautoPinEdgeToSuperviewEdge:ALEdgeLeadingwithInset:5];[mainImageautoPinEdgeToSuperviewEdge:ALEdgeTrailingwithInset:5];[mainImageautoMatchDimension:ALDimensionWidthtoDimension:ALDimensionWidthofView:self.viewwithOffset:-10];[mainImageautoPinEdge:ALEdgeToptoEdge:ALEdgeBottomofView:avatarwithOffset:10];vote.text=@"12次赞";[voteautoPinEdge:ALEdgeToptoEdge:ALEdgeBottomofView:mainImagewithOffset:10];[voteautoPinEdgeToSuperviewEdge:ALEdgeLeadingwithInset:15];[voteBtnsetTitle:@"赞"forState:UIControlStateNormal];[commentBtnsetTitle:@"评论"forState:UIControlStateNormal];[actionBtnsetTitle:@"……"forState:UIControlStateNormal];[voteBtnautoPinEdgeToSuperviewEdge:ALEdgeLeadingwithInset:15];[commentBtnautoPinEdge:ALEdgeLeadingtoEdge:ALEdgeTrailingofView:voteBtnwithOffset:4];[actionBtnautoPinEdgeToSuperviewEdge:ALEdgeTrailingwithInset:15];[@[voteBtn,commentBtn,actionBtn]autoAlignViewsToAxis:ALAxisHorizontal];[voteBtnautoPinEdge:ALEdgeToptoEdge:ALEdgeBottomofView:votewithOffset:10];[svautoPinEdge:ALEdgeBottomtoEdge:ALEdgeBottomofView:voteBtnwithOffset:10];}-(void)viewDidLoad{[superviewDidLoad];// Do any additional setup after loading the view.
}-(void)didReceiveMemoryWarning{[superdidReceiveMemoryWarning];// Dispose of any resources that can be recreated.
}/*
# pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/@end