UITableViewCell dynamic height :/

后端 未结 2 573
夕颜
夕颜 2020-12-29 00:37

Hee all,

I have created a UITableViewCell with a NIB file. There is 1 label in it wich is going to contain a tweet. So it needs to be a dynamic height. There also is

2条回答
  •  被撕碎了的回忆
    2020-12-29 01:19

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        NSString *string = [tweetsArray indexPath.row];
        CGSize labelSize = [string sizeWithFont:[UIFont fontWithName:@"Verdana" size:17.0] 
                                                         constrainedToSize:CGSizeMake(280.0f, MAXFLOAT) 
                                                             lineBreakMode:UILineBreakModeWordWrap];
        return labelSize.height + 20;
    }
    

提交回复
热议问题