2 개의 섹션으로 구성된 그룹화 된 테이블이 있습니다.재사용되는 셀의 유형을 변경 하시겠습니까?
첫 번째 섹션은 1 개의 셀이며 XIB의 특정 하위 클래스입니다. 표의 나머지 셀은 XIB없이 기본 데이터를 표시합니다.
내가 겪고있는 문제는 첫 번째 셀을 재사용 할 때 셀의 서브 클래스가 분명히 XIB를 사용하는 서브 클래스의 것이므로 데이터를 적용하려고 할 때 ' 그 위치에 적절한 라벨 등이 없어야합니다.
첫 번째 셀을 무시하고 두 번째 유형의 셀을 계속 사용하거나 셀 유형을 변경해야합니다.
이 상황을 처리하는 가장 좋은 방법은 무엇이며 어떻게 수행합니까?
필자는
if (cell == nil || [cell isKindOfClass:[InspectionMasterTableViewCell class]])
내 cellForRowAtIndexPath의 기본 레이아웃은 일반적으로이
if (indexPath.section == InspectionsMasterSectionData)
{
// CREATE CELL
static NSString *CellWithIdentifier = @"InspectionMasterTableViewCell";
InspectionMasterTableViewCell *cell = (InspectionMasterTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
if (cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"InspectionMasterTableViewCell" owner:nil options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
return cell;
}
else
{
static NSString *CellWithIdentifier = @"FormTableViewCell";
FormTableViewCell *cell = (FormTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
if (cell == nil || [cell isKindOfClass:[InspectionMasterTableViewCell class]])
cell = [[FormTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellWithIdentifier];
//CELL DATA
return cell;
}
내 일반적인 레이아웃을 표시하도록 편집 됨 – JMD
InspectionMasterTableViewCell.xib의 셀에 대해 동일한 재사용 식별자 "InspectionMasterTableViewCell"을 설정 했습니까? –