UITableView
행을 업데이트하는 데 문제가 있습니다. 내 tableView
에서는 단 하나의 행만 선택할 수 있습니다 (두 개의 섹션이있을 수 있습니다). 따라서 사용자가 행을 선택할 때이 섹션의 다른 행을 프로그래밍 방식으로 선택 취소합니다. 선택 취소 된 행이 표시되면 모든 것이 작동합니다. 선택 취소 된 행이 표시되지 않으면 계속 선택됩니다. 그러나 didDeselectRowAtIndexPath
이이 행에 호출됩니다. 왜? 이 문제를 해결하는 방법?보이지 않는 행 선택 취소
- (NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
// It is predefined group - only one row in section cab be selected
// Deselect other rows in section
for (NSIndexPath * selectedIndexPath in tagTableView.indexPathsForSelectedRows) {
if (selectedIndexPath.section == indexPath.section) {
[self tableView:tableView didDeselectRowAtIndexPath:selectedIndexPath];
[tableView deselectRowAtIndexPath:selectedIndexPath animated:YES];
}
}
return indexPath;
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tagTableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}
보이지 않는 행을 선택 취소 할 수없는 경우 UIKit에 버그가 있습니다. 그런 다음에 붙어 있습니다. – Andy