Xcode 某些位置的自定义表视图单元格

Xcode 某些位置的自定义表视图单元格,xcode,ios5,uitableview,Xcode,Ios5,Uitableview,我正在构建一个自定义分组的TableView,需要在indexPath.row=0处显示一个自定义TableViewCell(当节为0时)。我可以显示它,但一旦我转到TableView的底部,所有单元格都会更改 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSArray *listData =[self.tableCon

我正在构建一个自定义分组的TableView,需要在indexPath.row=0处显示一个自定义TableViewCell(当节为0时)。我可以显示它,但一旦我转到TableView的底部,所有单元格都会更改

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{

    NSArray *listData =[self.tableContents objectForKey:[self.sortedKeys objectAtIndex:[indexPath section]]];

    static NSString *simpleTableIdentifier = @"Cell";
    if (indexPath.row==0 && indexPath.section==0)
    {
        RightLabelCell *cell = (RightLabelCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
        if (cell == nil)
        {
             NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"RightLabelSetting" owner:self options:nil];
             cell = [nib objectAtIndex:0];
        }

        cell.leftLabel.text = [listData objectAtIndex:indexPath.row];
        cell.rightLabel.text=@"RightLabel";

        return cell;
    }
    else
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];

        }
        [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        cell.textLabel.text = [listData objectAtIndex:indexPath.row];

        return cell;
    }
}
并且在cell.leftLabel.text=[listData objectAtIndex:indexPath.row]处崩溃

转到界面生成器,选择自定义单元格和其他单元格,并为它们指定不同的标识符单元格名称

 static NSString *simpleTableCellIdentifier = @"Cell"; 

并根据条件选择合适的选项

static NSString *customTableCellIdentifier = @"CustomCell";