[self.bgView addArrangedSubview:self.problemDescLabel];
[self.bgView addArrangedSubview:self.problemLabel ];
[self.bgView addArrangedSubview:self.happenDateLabel];
[self.bgView addArrangedSubview:self.commitLabel];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(-SLMargin);
}];
self.bgView是UIStackView,其中make.bottom.mas_equalTo(-SLMargin);就可以算出cell的高度
/**
算高度
*/
CGFloat height = [tableView fd_heightForCellWithIdentifier:identifier cacheByIndexPath:indexPath configuration:^(QualityRecordCell *cell) {
QualityRecordModel *model = self.dataList[indexPath.row];
cell.model = model;
}];
return height+Space;
/**
tableView的高度
*/
+ (CGFloat)calculateTableViewHeightWithDataList:(NSArray *)dataList inTableView:(UITableView *)tableView {
CGFloat totalHeight = 0.0;
for (NSInteger row = 0; row < dataList.count; row++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
CGFloat rowHeight = [tableView.delegate tableView:tableView heightForRowAtIndexPath:indexPath];
totalHeight += rowHeight;
}
return totalHeight;
}