Question

I implemented the commitEditingStyle method to delete a row from my tableview. If I simply put [timersArray removeObjectAtIndex:indexPath.row] the row deletes just fine. The only problem is that it does not animate so I tried putting this:

[self->tableView beginUpdates];
[self->tableView deleteRowsAtIndexPaths:timersArray withRowAnimation:UITableViewRowAnimationBottom];
[self->tableView endUpdates];

but when I try and delete something it brings up this:

'NSInvalidArgumentException', reason: '-[Timer row]: unrecognized selector sent to instance 0x17ed37b0'

I thought it was because the timersArray is a NSMuttableArray and not a NSArray but that did not change anything. Can someone help me find out how to fix this? Anything will help. Thanks!

Was it helpful?

Solution

I fixed the issue by adding [NSArray arrayWithObject:indexPath] in place of timersArray in order for that to work I had to place the [timersArray removeRowAtIndex:indexPath.row] above the [self->tableView beginUpdates] and at that point it worked!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top