1
votes

Can any body tell me how can I achieve this. I want to delete a row from tableview with animation. Here goes my sample code

    [section0ARR removeObjectAtIndex:row];
    NSIndexPath *index = [NSIndexPath indexPathForRow:section inSection:row];
    [myTableVEW beginUpdates];
    [myTableVEW deleteRowsAtIndexPaths:[NSArray arrayWithObject:index]    withRowAnimation:UITableViewRowAnimationFade];

    [myTableVEW endUpdates];

Application crashes while attempting this with this assertion Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:1046

but things work perfectly fine if I simply reload my table but in that case animation is not visible.

Here is a checklist

  1. removed item from datasource
    1. deleted row from tableview with animation

please help me to get rid of the crash.

Regards Ankit

1
Have u checked for numberOfRowsInSection:?Vidya Murthy
@Invincible yupp I checked that its as expected I tracked my code till there it crashes after thatAnkit Sachan
Tried using tableView:commitEditingStyle:forRowAtIndexPath:?Vidya Murthy
@Invincible when you use "deleteRowsAtIndexPaths" it doesnt goes to commitEdittingStyle methodAnkit Sachan
Hmm.. What is on line 1046 in that class?Vidya Murthy

1 Answers

1
votes

Try changing:

 NSIndexPath *index = [NSIndexPath indexPathForRow:section inSection:row];

To this:

 NSIndexPath *index = [NSIndexPath indexPathForRow:row inSection:section];

(I'm assuming that row and section are valid values since we don't have the rest of the code.)