- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
PostCount *post=[listArr objectAtIndex:indexPath.row];
//NSString *CellIdentifier = [NSString stringWithFormat: @"Cell%d_%d_%@_%d",indexPath.section,indexPath.row,post.foreignId,[listArr count]];
NSString *CellIdentifier = [NSString stringWithFormat: @"Cell_%d_%@",indexPath.row,post.foreignId];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSLog(@"indexPath.row++++++++=%d",indexPath.row);
TimeLineGraphicView *gview=[[TimeLineGraphicView alloc]init];
gview.tag=indexPath.row+1000;
gview.delegate=self;
[cell addSubview:gview];
int Allheight =[ModelClass returnGraphicViewHeight_timeLine:post];
gview.frame=CGRectMake(0, 0, 320, Allheight);
[gview setViewStyle:post];
}
TimeLineGraphicView *gview=(TimeLineGraphicView *)[cell viewWithTag:indexPath.row+1000];
gview.lab_time.text=[ModelClass intervalSinceNow:post.when btime:0];
//NSLog(@"intervalSinceNow=%@ ",[ModelClass intervalSinceNow:post.when btime:0]);
//NSLog(@"post.when=%@ gview=%@ gview.lab_time.text=%@",post.when,gview, gview.lab_time.text);
return cell;
}
你好,如果我有很多单元格,如果我使用上面的代码,TimeLineGraphicView *gview=[[TimeLineGraphicView alloc]init] 可以增加内存,因为当我加载很多单元格时,例如我首先加载15个单元格,然后添加15个单元格然后添加15个单元格等,它给我做了ReceiveMemoryWarning,你能很好地处理这个问题吗