Calculating multiline text height for UILabel/UITableViewCell: different results when calculating vs actual drawing

前端 未结 3 890
情深已故
情深已故 2021-01-30 05:09

This general topic has been asked here multiple times: how to render UITableViewCells with varying amount of text and thus varying height. The canonical answer is: you calculate

3条回答
  •  时光取名叫无心
    2021-01-30 05:44

     titleSize = [title sizeWithFont:[UIFont systemFontOfSize:(CGFloat)17.0]
                                    constrainedToSize:CGSizeMake(280, 2000)
                                        lineBreakMode:NSLineBreakByWordWrapping];
    

提交回复
热议问题