0

Here is the code that adds a delete button:

 (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{

    return YES;
}


(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {

        NSLog(@"delete pressed");

    }
    else if (editingStyle == UITableViewCellEditingStyleInsert) {

    }
}
Nizam
  • 5,698
  • 9
  • 45
  • 57
user2838188
  • 165
  • 1
  • 12
  • Please visit this link. http://stackoverflow.com/questions/17254402/swipe-to-delete-and-the-more-button-like-in-mail-app-on-ios-7 – Adnan Aftab Nov 04 '13 at 09:24

1 Answers1

0

You can't do that using UITableViewCell, you need to create your own custom UITableViewCells and lay out those views yourself when the cell enters in edit mode.

Antonio MG
  • 20,382
  • 3
  • 43
  • 62
  • do you know any library that can help me to do that? – user2838188 Nov 04 '13 at 09:24
  • The Apple Docs are pretty good https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1 – Antonio MG Nov 04 '13 at 09:38