I have a UICollectionView
and a custom UICollectionViewCell
I want to be able to catch the UICollectionView
gestures as a UIGestureRecognizerDelegate
, actually I want to handle some gestures collisions by using this delegate's method:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
How can I catch the UICollectionView
's UIGestureRecognizerDelegate
?
UICollectionView
does listen for taps but not by using a UIGestureRecognizer
.
But you could add your own UIGestureRecognizer
for the type your interested in (like UITapGestureRecognizer
for instance) to the UICollectionView
, set the delegate on it and in gestureRecognizerShouldBegin:
return YES or NO depending on whether you want the UICollectionView
to do it's thing or not, i.e. returning NO would cancel your gesture and allow the collection view to handle the touches.
Or set delayTouchesBegan
to YES if you just want your gestures to take priority over the collection view touch handling.
More info is here Collection View Programming Guide