Swipe to Delete not working

后端 未结 7 2216
说谎
说谎 2021-02-20 15:55

The swipe to delete functionality is not working in my table view. I have implemented the commitEditingStyle delegate and the Edit button in the navigation bar. Hence when the u

7条回答
  •  臣服心动
    2021-02-20 16:42

    For swipe-to-delete functionality, you have to implement

     -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (editingStyle == UITableViewCellEditingStyleDelete)
            ; // Delete.
    }
    

    EDIT: I didn't read the question well enough.

    I have noticed that to do a swipe drag in the simulator I have to press and pause for a second while it selects the cell, and only then can I swipe right successfully.

提交回复
热议问题