【发布时间】:2016-08-18 09:55:46
【问题描述】:
我正在使用 Masonry 来设置子视图的约束。
视图控制器很简单。
在 viewDidLoad 中
-(void)viewDidLoad
{
[self.view addSubview: self.tableView];
self.view.backgroundColor = [UIColor whiteColor];
[self.tableView addSubview: self.botBtn];
[self.botBtn makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.tableView.bottom).with.offset(-20);
make.centerX.equalTo(self.tableView);
}];
}
table view 的框架是 CGRectMake(0,0,screen_width,screen_height), 但按钮在屏幕之外,就在 tableview 的顶部。
我在它的 init 方法中设置了 tableview 框架。 该按钮水平保持在视图的中间,因此自动布局似乎可以工作,但为什么它位于 tableview 的顶部而不是留在底部。
【问题讨论】:
标签: ios objective-c uiviewcontroller