sooper
sooper

Reputation: 6039

UITapGestureRecognizer cancels out didSelectRowAtIndexPath in UITableViewController

I've subclassed UITableViewCell and inside the class I've added a UITapGestureRecognizer (which fires a method called animateCell) to the contentView.

What I'm trying to do: When the user taps a cell, animateCell is called (which works), but I also want didSelectRowAtIndexPath to be called so that I can add the selected object from the table's source-array into another array.

What I've noticed is that having the UITapGestureRecognizer cancels out didSelectRowAtIndexPath. Is there any way I can have both at the same time?

Upvotes: 0

Views: 261

Answers (1)

edc1591
edc1591

Reputation: 10182

It's kind of hackish, but you can try creating a property in your UITableViewCell subclass that holds a pointer back to your UITableViewController. Then from your gesture recognizer you could do something like this:

NSIndexPath *indexPath = [self.tableViewController.tableView indexPathForCell:self];
[self.tableViewController tableView:self.tableViewController.tableView didSelectRowAtIndexPath:indexPath];

Upvotes: 1

Related Questions