TheLearner TheLearner - 2 years ago 198
iOS Question

UITableViewCell, show delete button on swipe

How do I get the delete button to show when swiping on a


I have followed this post, but the event is never raised and the delete button never appears!

Answer Source
// During startup (-viewDidLoad or in storyboard) do:
self.tableView.allowsMultipleSelectionDuringEditing = NO;

// Override to support conditional editing of the table view.
// This only needs to be implemented if you are going to be returning NO
// for some items. By default, all items are editable.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return YES if you want the specified item to be editable.
    return YES;

// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //add code here for when you hit delete
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download