Reputation: 642
I have a simple UICollectionView with a single custom cell. Everything is working as expected, but tapping any of the items in the collection does not seem to call the didSelectItemAtIndexPath event, except when:
A. Tapping with 2 fingers on the Cell B. Swiping from either Left To Right or Right to Left
The cell contains 2 subviews, some objects on each. All are marked with "Enable User Interaction".
BTW: I made sure I'm "didSelectItemAtIndexPath" and not "didDeselect..."
I don't want to add a UITapGestureRecognizer to fix this as it seems "hacky". Any ideas?
Thanks!
Upvotes: 1
Views: 979
Reputation: 642
Duh. I've just found the issue:
There was this gestureRecognizer attached to the view, which was trapping the single tap event. I attached it to the required object and it all worked!
self.view.addGestureRecognizer(UITapGestureRecognizer(target: SearchBar, action: "resignFirstResponder"))
Upvotes: 2