tableView行高计算
作者:
搬码小能手 | 来源:发表于
2020-05-28 13:50 被阅读0次- (CGFloat)cellHeight{
// 如果cell的高度已经计算过, 就直接返回
if (_cellHeight) return _cellHeight;
// 文字
CGFloat textMaxW = [UIScreen mainScreen].bounds.size.width - 80;
CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT);
CGSize textSize = [self.sectionname boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15]} context:nil].size;
_cellHeight += textSize.height + 46;
return _cellHeight;
}
本文标题:tableView行高计算
本文链接:https://www.haomeiwen.com/subject/yrzoahtx.html
网友评论