ユーザーが新しいセルを選択するときに、選択したセルの選択を解除する必要があるアプリケーションがあります。テーブルビューの行の選択と選択解除を行うことはできますが、問題は、一度に1つの行のみを選択する必要があることです。私は今こうやっていた、
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell_check.png"]];
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell.png"]];
}
しかし、これでは同じ行を選択および選択解除できます。しかし、私の意図は、他のセルがすでに選択されている場合に新しい行を選択するときに、選択を解除する必要があることです。どんな体も私を助けることができますか?