使用Masonry给视图添加约束
问天几高 2016-06-21 02:38:48 我的代码是这样的:
self.childView= [[UIView alloc]initWithFrame:screen];
[self.view addSubview: self.childView];
self.childView.backgroundColor = [UIColor redColor];
UIButton *button = [[UIButton alloc]init];
[self.childView addSubview: button];
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.childView).with.insets(UIEdgeInsetsMake(100, 200, 100, 100));
}];
使用masonry来给视图自动添加约束,思路-->父视图上面添加一个子视图,该子视图上面把所有要显示的视图都添加在它上面
但运行报错:
Exception:-[UIButton mas_makeConstraints:]: unrecognized selector sent to instance 0x7feef061f520
大神求帮助