模拟Masonry的链式编程,形式如:
[_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.height.mas_equalTo(66);
}];
思想(简单理解):
//1,left 等四个方法是MASConstraintMaker的方法,这个方法需要返回值为block,且block参数为int(id),返回值: MASConstraintMaker*
//2, mas_makeConstraints方法实现部分:
+ (int)makeTheManger:(void(^)(counterManger *manger))block{
counterManger * manger = [[counterManger alloc]init];
block(manger);
return manger.result;
}
网友评论