I have an editable, grouped tableView, but swipe to delete doesn’t work. It looks like swipe-to-delete is supposed to come along with UITableViewCellEditingStyleDelete, but it doesn’t seem to for me. This is my editing style method:
- (UITableViewCellEditingStyle)tableView:(UITableView *)table editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 1)
{
if (indexPath.row < [[device_coordinator getChannelList] count]) return UITableViewCellEditingStyleDelete;
else if (indexPath.row < [[device_coordinator getChannelList] count]+2) return UITableViewCellEditingStyleInsert;
}
return UITableViewCellEditingStyleNone;
}
This makes the table look right. Some cells have insert icons to the left, some have delete icons, as they should. Pressing a delete icon makes the delete confirmation button appear. But a swipe doesn’t!
Even if I just return blank, newly allocated cells from my cellForRowAtIndexPath method, it still doesn’t work, so it appears that nothing in my cell is causing the problem. The same problem happens on the 4.3 simulator and on my iPod touch 2g.
I think your code is correct but if I understand you right there is a logical error. You want swipe to delete in editing mode which is not possible. Swipe to delete only works when the user is NOT in editing mode.
So you just need to hide/show the editing icons by calling this method.
Then swipe to delete will work when there are no icons next to the cells. Hope this helps.