I have 2 views. View 1 is superview and i added tap gesture in superview. View 2 is Collectionview and when I click on collectionview cell both event didSelectItemAt in Collectionview and tap gesture in superview called.How can disable tap gesture in supperview when I click on collectionview cell?
You can try to set userInteractionEnabled
to false
on your parent view.
E.g view.userInteractionEnabled = false
Docs at userInteractionEnabled
--UPDATE
You can implement gestureRecognizer delegate,a nd then check if it is your view that called on touch
property;
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if touch.view == {{youview}} {
return false
}
return true
}