同事写的创建控件的代码形式有点不认识...是masonry的特殊形式?
UIButton * button = ({
button = [[UIButton alloc] init];
button.backgroundColor = [UIColor lightGrayColor];
[button setTitle:@"button" forState:UIControlStateNormal];
[button addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
button.layer.cornerRadius = 30.f;
button.layer.masksToBounds = YES;
[_bottomView addSubview:button];
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY . equalTo (button.mas_centerY);
make.right . equalTo (button.mas_left).offset(-10);
make.width . equalTo (@(60));
make.height . equalTo (@(60));
}];
button;
});
是一种比较特殊的表达式而已,具体看
小括号内联复合表达式: http://blog.sunnyxx.com/2014/08/02/objc-weird-code/