user635064
user635064

Reputation: 6247

UIView inside UIScrollView not getting touch events

My view hierarchy looks like this:

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

I have implemented touchesBegan in CustomUIView, but it's not getting called.

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

Upvotes: 3

Views: 4550

Answers (2)

Thomas
Thomas

Reputation: 1023

You may have solved this now but I had a similar problem and solved it so hopefully my experience can help anyone else with a similar issue.

In my case I had exactly the same setup my CustomUIView was capturing the touch events. In order to have UIView receive any touch events I needed to make a call to

[super touchesEnded:touches withEvent:event];

from the CustomUIView. Hope this helps!

Upvotes: 1

HG's
HG's

Reputation: 828

Try the following and check:

[scrollView setCanCancelContentTouches:NO];

Upvotes: 2

Related Questions