- tableviewcell 添加约束,约束需要添加到contenview 上面,否则就不显示子视图内容
// SubmitOrderTCell 是一个UITableViewCell ,附带对应xib 文件布局
SubmitOrderTCell *submitOrderTCell = [[NSBundle mainBundle] loadNibNamed:[SubmitOrderTCell cellIdentifiter] owner:nil options:nil].firstObject;
//TODO: 注意适配ipx
submitOrderTCell.frame = CGRectMake(0, view.frame.size.height - kCellHeight, kScreen_Width, kCellHeight);
//必须是submitOrderTCell.contentView 添加约束,采用submitOrderTCell 无效
[view addSubview:submitOrderTCell. contentView];
[submitOrderTCell.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.mas_equalTo(0);
make.height.mas_equalTo(kCellHeight);
}];
return submitOrderTCell;
网友评论