2

I have a UIScrollView which has been subclassed to get the touch events. There is a UIView inside the UIScrollView and the UIView in turn has several subviews.

So basically the structure is UIScrollView > UIView > UIView's.

The UIView's has been given a tag so as to detect the view which was tapped.

But the touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event is fired twice whenever I tap the UIView.

What might have gone wrong?

I subclassed the UIScrollView as mentioned here : Touches Began.

Community
  • 1
  • 1
Sreejith
  • 1,345
  • 13
  • 25

1 Answers1

0

I had the same issue, only while iPad, and noticed that the touches param was the same, e.g. with po touches in the LLDB console gave me exactly the same data, excepted the "location in view". I interpret this that another view forwarded the event, in this case the main UIWindow, so tried: UIWindow *theMainWindow = [[UIApplication sharedApplication] keyWindow]; theMainWindow.gestureRecognizers = 0;

It works. I verified that the iPhone version still works fine (with Pan and Zoom).

tontonCD
  • 320
  • 2
  • 6