1

Im adding a UIView as a subView to a scrollView. However, I wish to detect touches in the UIView. But i notice that when i do something like this:

[self.myScrollView addSubview:myView];

then, the touchesDidBegin method is never called when i touch the subview. However, if i do the following,

[self.view addSubview:myView];

then, the touchesDidBegin method is called. However, now the subView does not scroll along with the scroller obviously.

I want "myView" to be added to the scrollView as a subview so that it scrolls along with it and also detects touches on it. Any way to accomplish this?

Greg
  • 33,450
  • 15
  • 93
  • 100
ulag
  • 23
  • 2
  • Duplicate of the questions mentioned by Jhaliya below. [1](http://stackoverflow.com/questions/241152/handling-touch-events-within-a-child-uiscrollview) [2](http://stackoverflow.com/questions/1363598/touch-events-not-working-on-uiviews-inside-) – jscs Mar 24 '11 at 00:43

1 Answers1

0

The same has already discussed here, plz find the link to similar SO post.

Handling touch events within a child UIScrollView

Touch events not working on UIViews inside UIScrollView uiscrollview

Community
  • 1
  • 1
Jhaliya - Praveen Sharma
  • 31,697
  • 9
  • 72
  • 76