计算次数,有点 死循环的感觉,

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

   return [[[self heightArray]objectAtIndex:indexPath.row]floatValue];//几百个 heightArray,

}

 

-(NSArray *)heightArray

{

    NSMutableArray *arr = [[NSMutableArrayalloc] init];

    for (MessageDetailInfo *info inself.dataArray) {

        CGSize contentSize = [info.contentsizeWithFont:[UIFontsystemFontOfSize:13.0f] constrainedToSize:CGSizeMake(labelWidth, MAXFLOAT)];

        NSString *heightString = [NSString stringWithFormat:@"%.0f",contentSize.height + 120];

        [arr addObject:heightString];

    }

    return arr;

}

posted @ 2013-08-07 13:45  路在脚下,  阅读(238)  评论(0编辑  收藏  举报