하나의 섹션이있는 UITableView가 있습니다. 해당 섹션의 셀에는 모두 PLContactCell이라는 UITableViewCell의 하위 클래스에서 파생 된 셀이 있습니다.DIITerent 형식 및 동작 동일한 테이블의 섹션 UITableView 셀
내가하고 싶은 것은 테이블의 마지막 행에 대해서만 PLContactCell을 사용하지 않는 것입니다. 난 그냥 포맷 할 수있는 정상적인 UITableViewCell을 사용하고 싶습니다 그러나 내가 원할 것입니다. 나는 또한이 세포가 도청당하는 것에 반응하지 않도록 할 수 있기를 바란다.
내 초기 cellForRowAtIndexPath 방법은 다음과 같습니다 그래서 내가 XIB 파일에 jQuery과 셀을 만들고 여기에 "newCell"의 재사용 식별자를 추가하려고
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
PLContactCell *cell = [tableView dequeueReusableCellWithIdentifier:[PLContactCell reuseIdentifier]];
if (!cell) {
cell = [PLContactCell reusableCell];
cell.delegate = self;
}
id modelObject = [[sections objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
if ([modelObject isKindOfClass:[NSString class]]) {
[cell configureWithString:modelObject];
} else {
[cell configureWithUser:modelObject];
}
return cell;
}
편집 할 수 있습니다. 그런 다음이 코드를 추가했습니다.
if (indexPath.row == [[sections objectAtIndex:indexPath.section] count] - 1) {
NSString *CellIdentifier = @"newCell";
noFormatCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
}
아무 것도하지 않습니다. 내 질문은, 어떻게 섹션의 마지막 행에 액세스 할 수 있으며 어떻게 그 셀은 PLContactCell 아니라 UITableView 셀을 만들 수 있도록합니까.
특정 질문이 있으십니까? –
아마도'cellForRowAtIndexPath : '의 시작 부분에서 (indexPath.row + 1)을 [tableView numberOfRowInSection : indexPath.section]과 비교하여 마지막 셀에 있는지 알 수 있습니다. 그렇다면 다른 셀을 호출하십시오. 하지만 당신이 필요로하는 것 같습니다 데릭 대답을 고려하십시오. – zbMax
@ TimothyMose : 제 질문은, 어떻게 섹션의 마지막 행에 액세스 할 수 있으며 어떻게 그 세포가 PLContactCell하지만 UITableView 셀되지 않도록합니다. – jac300