アサーション失敗エラーuibleviewから行を削除しようとしたときのエラー
-
13-12-2019 - |
質問
UiTableViewから行を送付しようとすると、このエラーが発生します。
アサーションの失敗 - [UibleView _EndCellanimationsWithContext:]
と他の時間問題がない場合はその行を削除します。
これは私のコードです:
- (void) tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[[self displayedObjects] removeObjectAtIndex:[indexPath row]];
// Animate deletion
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
[[self tableView] deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
}
}
. 解決
numberofrowsinsection のように聞こえますは、編集モードを入力したときに間違った整数を返します。
他のヒント
それほど確かない。しかし、これを試してみてください(1回働いた)
最初にUiTableViewの削除をアニメートしてから、アレイからオブジェクトを削除します。
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// Animate deletion
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
[[self tableView] deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
[[self displayedObjects] removeObjectAtIndex:[indexPath row]];
}
. 所属していません StackOverflow