0

Possible Duplicate:
Dragging an UIView inside UIScrollView

My app has a scrollview which contains progressBar and imageviews etc.

Now i want to add TapGestureRecognizer only to the imageviews that are in my scroll view.

i am able to add TapGestureRecognizer to my total scrollview but not my images which are in scrollview

NOTE: Want to add TapGestureRecognizer only to my imageviews that are subviews of my scrollView, not to entire scrollView.

Here is my code:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];
[myScrollView addGestureRecognizer:singleTap];
Community
  • 1
  • 1
Steve Gear
  • 757
  • 2
  • 16
  • 44
  • why you are not adding this to your imageView, have you tried and what issue you faced in that? What code you have used to add this to your imageViews? – rishi May 29 '12 at 08:03
  • I agree with @rishi, if you want the subview to respond to the gesture, add the gesture directly to it. – Mick MacCallum May 29 '12 at 08:07
  • @rishi i already tried like "UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)]; [myImageView addGestureRecognizer:singleTap];" for my imageview but that was not worked – Steve Gear May 29 '12 at 08:31
  • 1
    @laxcha - you need to set userInteractionEnabled of your imageView to True, by default that if false. – rishi May 29 '12 at 08:33

0 Answers0