【发布时间】:2012-02-07 10:28:02
【问题描述】:
我在 uitableview 单元格中显示超过 10 列并且有超过 100 行,但是当我滚动 tableview 或重新加载表格时,它收到内存警告并且应用程序崩溃。 我们也在这个表格视图上使用折叠和展开。
以下代码应用于 cellforrowatindexpath
for(i=0;i<[appDel.tempItemDic count];i++)
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(CNT+30, -30, 350,100)];
label.font = [UIFont systemFontOfSize:14.0];
label.text =[tempDic objectForKey:[appDel.arrColumnList objectAtIndex:[[appDel.tempArr objectAtIndex:i]intValue]]];
label.textAlignment = UITextAlignmentLeft;
label.textColor = [UIColor whiteColor];
label.backgroundColor=[UIColor clearColor];
label.numberOfLines=1;
[cell.contentView addSubview:label];
[label release];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"ListItems_secondLevel(3).png"]];
cell.backgroundView = backgroundView;
cell.imageView.image=[UIImage imageNamed:@"arrow.png"];
CNT+=350;
}
【问题讨论】:
-
这不是 UITable 的工作方式。这是一篇解释 cell reuse 的博文。
标签: objective-c ios cocoa-touch uitableview