刘海屏:顶部安全距离44、有导航栏(44)88,底部安全距离34、有tabbar(49)83
- (void)addConstraint
{
self.multTableView.snp.makeConstraints { (make) in
make.leading.trailing.equalToSuperview()
make.bottom.equalTo(self.footerView.snp.top)
if #available(iOS 11, *) {
make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top)
} else {
make.top.equalToSuperview()
}
}
self.footerView.snp.makeConstraints { (make) in
make.leading.trailing.equalToSuperview()
make.height.equalTo(55)
if #available(iOS 11, *) {
make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)
} else {
make.top.equalToSuperview()
}
}
// 填补self.view与footerView之间的空隙
let safeAreaBottomSpaceView = UIView()
safeAreaBottomSpaceView.backgroundColor = .cyan
self.view.addSubview(safeAreaBottomSpaceView)
safeAreaBottomSpaceView.snp.makeConstraints { (make) in
make.leading.right.bottom.equalToSuperview()
make.top.equalTo(self.footerView.snp.bottom)
}
}
- (void)addConstraint
{
[super addConstraint];
[self.navigationBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(kTopHeight);
}];
CGFloat kFooterViewHeight = 65.0;
[self.safeAreaBottomBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.top.mas_equalTo(self.footerView);
make.bottom.mas_equalTo(self.view);
}];
[self.footerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.view);
make.height.mas_equalTo(kFooterViewHeight);
if (@available(iOS 11.0, *)) {
make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom);
} else {
make.bottom.mas_equalTo(self.mas_bottomLayoutGuideBottom);
//make.bottom.mas_equalTo(self.view);
}
}];
}
网友评论