I have an iPhone app that utilizes TableView to list tagged items that the user has saved. I have Swipe to Delete enabled for these items yet I’m running into an issue with the very first item in the table. All other items show the “Delete” button when swiped, but it does not work for the very first row.
I’ve searched and searched for an answer to this. I’d appreciate the help!
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
if([indexPath row] == 0) {
return UITableViewCellEditingStyleNone;
}
return UITableViewCellEditingStyleDelete;
}
You should return
UITableViewCellEditingStyleDeletefrom tableView:editingStyleForRowAtIndexPath: for all rows that should support delete.UPDATE
I have explained what your code does in some added comments, so you can see the problem: