Swipe to Delete not working

后端 未结 7 2209
说谎
说谎 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:31

    I was doing the following in the tableView:editingStyleForRowAtIndexPath: delegate method :-

    if (self.editing == NO || !indexPath)
    {   
        return UITableViewCellEditingStyleNone;
    }
    

    This was supposed to return editing style none if no indexPath was selected. For some reason whenever a swipe action was performed, this particular if condition was getting executed. On commenting the above code snippet, the swipe to delete action worked fine.

    Thanks all for your help.

提交回复
热议问题