Chabbey François
Chabbey François

Reputation: 95

UIButton and swipe-to-delete on UITableViewCell

I have a custom UITableViewCell with a UIButton. UIButton blocks the swipe-to-delete gesture recognizer implemented by Apple; if the swipe starts on the button, the swipe is not recognized, otherwise the delete button appears and everything works correctly

At the moment, I have replace the UIButton by an UIImageView to get the desired behaviour.

I would like if somebody manages to make this work.

I have already tried to implement this delegate method

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

and searched the view/subviews for all its gesture recognizers and assign them the cell as delegate. I still can make it work with a UIButton.

I target ios8

Thanks

Upvotes: 0

Views: 152

Answers (1)

user501836
user501836

Reputation: 1186

Use UILable or UIImage instead of UIButton, and set userInteractionEnabled to YES, and add a UITapGestureRecognizer gesture to it.

Upvotes: 0

Related Questions