Reputation: 927
I have a parent view which is red on the screen, and inside it, there is a child view which is green. When trying position child to left-bottom corner, code below failed.
[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);
}];
How to fix this issue?
Upvotes: 0
Views: 273
Reputation: 1790
If you try set the leading constraint for the header view, e.g.
mas.leading.equalTo(@0);
Upvotes: 0