私はxcodeを初めて使用します。このコードを使用して、テーブルの最大から10行を選択しています。このコードは機能していますが、そこから 1 つの行を選択すると、選択した他の値が自動的に選択されるという問題があります。これがどのようなエラーなのかわかりません。このエラーを削除するのを手伝ってください。ありがとうございました
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
if ([selectedCell accessoryType] == UITableViewCellAccessoryNone) {
if(count < 10)
{
[selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];
[selectedobjects addObject:[NSNumber numberWithInt:indexPath.row]];
count++;
}
} else {
[selectedCell setAccessoryType:UITableViewCellAccessoryNone];
[selectedobjects removeObject:[NSNumber numberWithInt:indexPath.row]];
count --;
}
}