私は2つの配列を持っています。各配列はセクションを取得します。ユーザーが行をスワイプして削除を選択すると、右側のセクションの適切な行を削除する必要があります。コードを変更して、正しいセクションで削除するにはどうすればよいですか。これはこれまでの私のコードです。
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//remove the deleted object from your data source.
//If you're data source is an NSMutableArray, do this
if (self.numberOfSections == 1)
{
[self.playerNames removeObjectAtIndex:indexPath.row];
}
else
{
//code here needs to determine which section needs to be deleted
}
[self.tableView reloadData];
}
}