Reputation:
if i press the particular cell(edit button's action will be taken without pressing edit button) in table view. wiil you answer please? th following code gives error...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSArray *deleteIndexPaths =[NSArray arrayWithObjects:
[NSIndexPath indexPathForRow:indexPath.row inSection:0],nil];
UITableView *tv = (UITableView *)self.view;
[tv beginUpdates];
[tv deleteRowsAtIndexPaths:deleteIndexPathswithRowAnimation:UITableViewRowAnimationFade];
[tv endUpdates];
}
Upvotes: 0
Views: 702
Reputation: 8944
You need also to delete the source of that cell from the datasource as tableview will try to reload the data after the update. Basically you need to update the result of
numberOfSectionsInTableView
and numberOfRowsInSection
so that it is relevant after the update.
Upvotes: 1