1

Case 1. I swipe to delete a row. Table goes in edit mode, but no Insertion/Deletion controls are displayed.

enter image description here

Case 2. I enter edit mode by pressing a button, and the table goes in edit mode, with the Insertion/Deletion controls displayed.

enter image description here

How can I programmatically distinguish between the two cases?

Adi
  • 321
  • 1
  • 17
  • 1
    possible duplicate of [How to detect edit mode on iphone UITableView](http://stackoverflow.com/questions/1776045/how-to-detect-edit-mode-on-iphone-uitableview) – Droppy Dec 08 '14 at 15:13
  • 1
    I don't think that works for me. My issue is that in both cases the table is in editing mode. – Adi Dec 08 '14 at 15:20

1 Answers1

0

To know if tableview's edit or insert which operation is committed then it can be known using UITableView delegate method

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(editingStyle == UITableViewCellEditingStyleDelete)
    {
       //delete operation
    }
    else if(editingStyle == UITableViewCellEditingStyleInsert)
    {
       //insert operation
    }
}

To know if tableview is in editing state then use UITableView's editing property

if ([tableView isEditing]) 
{
   //TableView in editing mode so do any remaining operation need to be done
}
else
{
   //TableView in not in editing mode
}
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132
  • 1
    Hi Prince! Your answer helps me distinguish between insert and delete, but that is not what I am interested in. I just want to know if the Insertion/Deleted control is displayed or not for a given cell. In both cases the table is in editing mode. – Adi Dec 08 '14 at 15:48