【发布时间】:2016-09-02 12:13:44
【问题描述】:
我有一个在屏幕上显示为红色的父视图,在其中有一个为绿色的子视图。尝试将孩子定位到左下角时,以下代码失败。
[superView addSubview:self];
self.backgroundColor = [UIColor redColor];
[self makeConstraints:^(MASConstraintMaker *make) {
make.width.left.top.equalTo(superView);
make.height.mas_equalTo(50);
}];
UIView *header = [[UIView alloc] init];
[self addSubview:header];
header.backgroundColor = [UIColor greenColor];
[header makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(30);
make.width.mas_equalTo(30);
make.bottom.equalTo(self);
}];
如何解决这个问题?
【问题讨论】:
标签: objective-c iphone masonry-ios-osx