DeleteRowsコードをヒットするたびに、更新の前後の行数を同じにする必要があるという例外が発生します。公式テキストは次のとおりです。
理由:無効な更新:セクション0の行数が無効です。更新後の既存のセクションに含まれる行数(3)は、更新前のそのセクションに含まれる行数(3)にプラスまたはマイナスで等しくなければなりません。そのセクションから挿入または削除された行の数(0が挿入され、1が削除されました)。
私のコードは次のとおりです。
public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
{
if (editingStyle == UITableViewCellEditingStyle.Delete)
{
tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Fade);
// Remove the step from the set of calculations
_calculation.Steps.RemoveAt(indexPath.Row);
}
}