0

I come to a problem... Here's it:

I add a UIGestureRecognizer to self.view (self is a UIViewController) and handle the tap event.

But I have another UIView which is a subview of self.view, and it has a reaction of "tap" gesture (touchesBegan and touchesEnded).

Problem arises : When I tap on it, because self.view intercept the gesture, the UIView can't get the event. So is there a way to emulate a "tap", or to let go naturally in the action function?

---add---

Forwarding UIGesture to views behind is a similar question, but in that case, it can pass a UIGestureRecognizer to subview.

in this case, I need to handle when the touch begins and when it ends, so it can't handle with a UIGestureRecognizer.

Or if I can adapt the functions with UIGestureRecognizer?

Community
  • 1
  • 1
DrustZ
  • 342
  • 1
  • 5
  • 19
  • Oh I foget to add, The Tap actually passed to the UIView, because the "touchesCancelled" is called. Why is this function called? – DrustZ Nov 06 '14 at 14:59
  • Possible duplicate of: http://stackoverflow.com/questions/9209998/forwarding-uigesture-to-views-behind – Tom Nov 06 '14 at 15:02
  • TouchesCancelled is called if the touch is interupted by the system, i.e. because of a low memory warning or an incoming phone call (see [Apple Documentation](https://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/index.html#//apple_ref/occ/instm/UIResponder/touchesCancelled:withEvent: ). It may however also be called if the system thinks the touch event should be handled by another view (i.e. if you start touching on a scrollview and the system detects that you are not starting a scroll event.) – Tom Nov 06 '14 at 15:05
  • I read the question above, but in that case, the subview has a function handle with "UIgestureRecognizer", which isn't suit for mine. – DrustZ Nov 06 '14 at 15:13

1 Answers1

0

Yeah I solved it with passing it a UIGesturerecognizer, and used this method: How to replace TouchesBegan with UIGestureRecognizer

Community
  • 1
  • 1
DrustZ
  • 342
  • 1
  • 5
  • 19