NSMutableArray
オブジェクトを表示するtableViewがあり、現在tableView:commitEditingStyle:forRowAtIndexPath:
メソッドを実装しようとしています。この行をコメントアウトすると[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
、UI の更新以外はすべて正常に機能します。
これは私のメソッドの実装です:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self.modelClass removeObjectAtRow:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
これは私が得るエラーです:
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2280.1/UITableView.m:1060
他の質問には、 を に置き換える必要があることを示唆する回答がありました@[indexPath]
が[NSArray arrayWithObject:indexPath]
、同じエラーが発生します。