簡(jiǎn)單實(shí)用
http://www.reibang.com/p/37ddbefc39d3
深入學(xué)習(xí)
http://www.reibang.com/p/bccc447e10b8
Masonry的介紹
http://www.cocoachina.com/ios/20141219/10702.html
源碼
https://github.com/SnapKit/Masonry
介紹Masonry基礎(chǔ)使用扮惦,很詳細(xì)
http://www.cnblogs.com/ios122/p/4826700.html
一個(gè)人的學(xué)習(xí)筆記,記錄的很完善
http://www.cnblogs.com/wqcoder/p/5511676.html
ios9開(kāi)發(fā)-autolayout
http://www.reibang.com/p/5a05e06fa9e3
https://github.com/qiuncheng/Autolayout
NSLayoutContraint
學(xué)習(xí)心得:
Masonry相關(guān)
.equalToequivalent toNSLayoutRelationEqual
.lessThanOrEqualToequivalent toNSLayoutRelationLessThanOrEqual
.greaterThanOrEqualToequivalent toNSLayoutRelationGreaterThanOrEqual
*兩個(gè)重要的宏
//define this constant if you want to use Masonry without the 'mas_' prefix
// 只要添加了這個(gè)宏,就不用帶mas_前綴
#define MAS_SHORTHAND
//define this constant if you want to enable auto-boxing for default syntax
// 只要添加了這個(gè)宏,equalTo就等價(jià)于mas_equalTo
#define MAS_SHORTHAND_GLOBALS
mas_makeConstraints與makeConstraints
用mas_makeConstraints的那個(gè)view需要在addSubview之后才能用這個(gè)方法
mas_equalTo于equalTo
mas_equalTo適用數(shù)值元素,equalTo適合多屬性的比如make.left.and.right.equalTo(self.view)
方法and和with只是為了可讀性镇草,返回自身,比如make.left.and.right.equalTo(self.view)和make.left.right.equalTo(self.view)是一樣的。
2.讓superview1略小于其superview(邊距為20)
UIView *superview1 =[UIView new];superview1.backgroundColor = [UIColor redColor];[superview addSubview:superview1];[superview1 mas_makeConstraints:^(MASConstraintMaker *make) {? ? // 寫(xiě)法一? make.edges.equalTo(superview).with.insets(UIEdgeInsetsMake(20, 20, 20, 20));? ? /** 寫(xiě)法二? ? make.top.equalTo(superview).with.offset(20);? ? make.left.equalTo(superview).with.offset(20);? ? make.bottom.equalTo(superview).with.offset(-20);? ? make.right.equalTo(superview).with.offset(-20);? ? **/? ? /** 寫(xiě)法三
make.top.left.bottom.and.right.equalTo(superview).with.insets(UIEdgeInsetsMake(20, 20, 20, 20));? ? **/}];
left/right 與 leading/trailing沒(méi)有什么區(qū)別
https://yq.aliyun.com/articles/16436
3.Masonry設(shè)置完約束后茉稠,馬上就回去frame的話,獲取的frame是不對(duì)的把夸,參考另外一篇文章而线。