Reputation: 2810
I have a UIView
subclass
that displays some content on top of camera preview
(AR
, but not ARKit
). In this view I use touchesBegan
and touchesEnded
to detect if user has pressed on displayed objects. Now I have this view embedded
in controller
inside UINavigationController
and this NavigationController
has enabled showing/hiding bars on tap. I would like to make so that if I detect tapping on object inside ARView
, then I can perform some action, but then touches are not received by NavigationController
, so that bars are hiding only if I tap on background. How can I block sending touch events further in such situation?
Upvotes: 0
Views: 1090
Reputation: 283
If you desire to limit touches on different views, you can change the property of userInteractionEnabled
on each condition you like.
When this property is set to false, no touch events will be received for selected views.
Upvotes: 1
Reputation: 575
so, if I understood you correctly, you want to recognize both events, and call methods of both gestures, right? If so, try this code snippet:
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
This method allows to recognize several gestures
Upvotes: 1