I have a situation where elements in a UITableViewCell subclass have either tap gesture recognizers or UIButtons.
When I tap these, not only do its handlers get called, but so does the didSelectRowAtIndexPath: delegate method.
Now, ideally, if the user doesn’t tap any of those elements, this should be passed on to the view underneath (i.e. the tableview or table cell) and be processed.
Why aren’t these elements swallowing the touches and preventing the TableView delegate method from firing?
I “hacked” a solution which puts a tapGesture recognizer on the contentView of my UITableViewCell subclasses, whose delegate is my custom UITableViewController subclass. I use an empty didSelectRowAtIndexPath: implementation. The delegate method is
And that did the job. Just need to remember when the cell is created to make sure I set the delegate.
Inelegant, but works fine.