Khant Thu Linn
Khant Thu Linn

Reputation: 6143

Detect closing of delete button (Swipe to delete) on UITableView

I am trying to detect closing of delete button on UITableView. So, I write inside this.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{

}

When I output otherGestureRecognizer, I saw like this.

(lldb) po otherGestureRecognizer
<UIGobblerGestureRecognizer: 0x7fbd8c21ccb0; state = Ended; view = <UITableView 0x7fbd89953000>; target= <(action=_handleSwipeDeleteGobbler:, target=<UITableView 0x7fbd89953000>)>>

I need to check like this. But, it is not allowed and need to use UISwipeGestureRecognizer. May I know how to detect whether user is closing Delete button in UITableViewCell?

if ([gestureRecognizer isKindOfClass:[UIGobblerGestureRecognizer class]])
{    
}

Upvotes: 0

Views: 586

Answers (1)

Sebastian
Sebastian

Reputation: 8164

In your UITableView delegate, you can use tableView:didEndEditingRowAtIndexPath: to get notified when the editing of the cell ends, which is also the state when the Delete button is about to disappear.

Upvotes: 3

Related Questions