I have a UIViewController that implements TableViews delegate and datasource protocols.
Now I want to add “swipe to delete” gesture to cells.
How should I go about it.
I have given a blank implementation of commitEditingStyle method and also set the Editing property to YES.
Still the swipe feature is not coming .
Now Do I need to separately add UISwipeGesture to each cell ?
Or am I missing something ?
You don’t have to set
editing:YESif you need to show Delete button on cell swipe. You have to implementtableView:canEditRowAtIndexPath:and return YES from there for rows you need to edit/delete. This is not necessary when your tableView’s dataSource is a subclass of UITableViewContoller – this method, if not overridden, returns YES by default. In all other cases you have to implement it.EDIT: Together we have found the problem –
tableView:editingStyleForRowAtIndexPath:returnedUITableViewCellEditingStyleNoneif table wasn’t in editing mode.