【发布时间】:2012-11-01 07:28:31
【问题描述】:
我有一个包含三个不同自定义单元格的表格视图。每个单元格将从三个不同的单元格类加载。`
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier1 = @"CellIdentifier";
static NSString *CellIdentifier2 = @"Cell";
static NSString *CellIdentifier3 = @"Cell";
if (indexPath.section == 0)
{
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell == nil)
{
cell = [[[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier1] autorelease];
}
cell.datelabel.text=@"dhhg";
cell.nameLabel.text=@"shdhsjdj";
cell.msg.text=@"sdhhhfhjhfj";
cell.myImageView.image=[UIImage imageNamed:@"sd.png"];
cell.likelabel.text=@"hhhf";
return cell;
}
else
{
Customcellwithimage *cell = (Customcellwithimage *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if (cell == nil)
{
cell = [[[Customcellwithimage alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier2] autorelease];
}
cell.datelabel1.text=@"sdhkhks";
cell.nameLabel1.text=@"sdhjkhkshd";
cell.msg1.text=@"sdsdsd";
cell.myImageView1.image=[UIImage imageNamed:@"shdjhjhs"];
cell.likelabel1.text=@"sjdh";
cell.bannerview1.image=[UIImage imageNamed:@"dshjs"];
return cell;
}
return Nil;
}
` .这是我的设计代码。谁能帮我解决我哪里出错了?
【问题讨论】:
-
当您取消注释图像内容时会发生这种情况吗?
-
它是从我的自定义类加载的。单元格本身包含一个图像。
-
是的,所以当你取消注释所有处理图像的代码时检查它是否仍然滞后,以便最终没有图像被加载。基本上,这应该可行,并且您有证据证明您的图像会导致滞后。
-
你使用网络图片对吗?