0

次のテーブルビュー メソッドを実装しています。

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

問題は、これがヒットすると、indexpath.row が範囲外として表示されることです。この行の削除ボタンを処理しようとしているので、セルを削除してテーブルビューのデータソースから値を削除できます。

4

1 に答える 1

0

あなたが見ているのは、xCode のデバッガーがおかしくなっていることです。これはたくさん起こります。私がしているのは、このようなローカル変数を作成し、そこにブレークポイントを設定すると、デバッガーがより適切に動作するようになります。

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
NSIndexPath temp = indexPath; //Set Debugger after this and you can inspect the variable.
}
于 2010-07-02T19:52:37.260 に答える