User interactions on table cells don’t have to be necessarily restricted to simply scroll and tap them. However, with some additional code and the support of gesture recognizers introduced in iOS 3.2 you can give your users the possibility to swipe on your table view cells for exciting additional actions. A common task for that would be to implement a swipe gesture for removing a single item within your table view (seen on several task management and todo apps) or simply changing the state of an item.
All you need is some pretty forward code like the following, which basically creates two gesture recognizers to handle left and right swipes on your table. As you can see we add these gesture recognizers directly to a UITableView
rather than to single UITableViewCells
.
The called methods of the gesture recognizers look like as stated below. From the gesture recognizer you’ll get the point of the start of the swipe gesture and with the indexPathForRowAtPoint:
method you can get the correct index path for the UITableViewCell
the swipe was performed on. From this point on it is up to you to perform more functionality to your table view cell.
Hi! Great Tutorial!! It works really great! Nevertheless I am having a slight problem.
When I move my table view up or dow, the checkmark disappears, I guess it is because of the reusable cell, thats being instantiated again and the checkmark is not added there.
Have you got any idea of how to solve this? My idea is to add id to a cell I create.
how to uitableviewcell swipe left and right to move next uitableviewcell
plz reply me..