Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect when the user has swiped an editable UITableViewCell?

I have an editable UITableView. By default the user can swipe and the Delete button will show up. I would like to hide some elements on my UITableView cell when this occurs. How can I do this?

like image 777
Sheehan Alam Avatar asked Dec 16 '22 09:12

Sheehan Alam


1 Answers

Oh c'mon:

tableView:willBeginEditingRowAtIndexPath:

...

Discussion

This method is called when the user swipes horizontally across a row; as a consequence, the table view sets its editing property to YES (thereby entering editing mode) and displays a Delete button in the row identified by indexPath. In this "swipe to delete" mode the table view does not display any insertion, deletion, and reordering controls. This method gives the delegate an opportunity to adjust the application's user interface to editing mode. When the table exits editing mode (for example, the user taps the Delete button), the table view calls tableView:didEndEditingRowAtIndexPath:.

Reference

And then throw some [[cell viewWithTag:<#View's tag number#>] setHidden:YES] for your own views.

like image 166
Can Avatar answered Dec 21 '22 23:12

Can