我有一个包含三个不同自定义单元格的表格视图。每个单元格将从三个不同的单元格类加载。`
- (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;
}
` .这是我的设计代码。有人能帮我解决我哪里出错了吗?