views:

3696

answers:

1

Here's what I've come up with:

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:1]; // my table view has 2 sections
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];

Everytime I build and run, it throws the following exception:

Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update must be equal to the number of rows contained in that section before the update, plus or minus the number of rows added or removed from that section.

It's a bit confusing. The section is set to 1, yet the exception says it's 0.

+7  A: 

I figured it out.

In addition to the aforementioned code, I also need to make changes to the datasource

[items removeObjectAtIndex:0];
QAD
That's correct.
Adam Ernst