- (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行高计算
最新推荐文章于 2024-04-24 13:35:29 发布