UIView inside UIScrollView does not receive touch events

My view hierarchy is as follows:

-UIScrollView
---UIView
------CustomUIView
------CustomUIView

I implemented touchesBeganin CustomUIView but did not receive the call.

Can someone please tell me how can I get my CustomUIView to detect touches?

+3
source share
2 answers

You may have solved it now, but I had a similar problem, and I decided that my experience could help someone else with a similar problem.

In my case, I had exactly the same setup as in CustomUIView, which captured touch events. For UIView to receive any sensory events, I had to call

[super touchesEnded:touches withEvent:event];

from CustomUIView. Hope this helps!

+1
source

:

[scrollView setCanCancelContentTouches:NO];
+2

All Articles