title: Detect tap on UIImageView inside UIScrollView
body: <p>I have a horizontal scrollview filled with <code>UIImageViews</code>. </p>
  
  <p>I want to detect a tap on the <code>UIImageView</code> and have its background color changed. </p>
  
  <p>Somehow the tap gesture is not working or so. </p>
  
  <p>However, when I add a tap gesture to the scrollview, it works. The <code>scrollview.background color</code> can be changed. </p>
  
  <p>But I want to detect a tap on the <code>UIImageViews</code> it contains!</p>
  
  <pre><code>UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 50, 768, 127)];
  [scrollView setScrollEnabled:YES];
  scrollView.backgroundColor = [UIColor orangeColor];
  [scrollView setShowsHorizontalScrollIndicator:NO];
  UIImageView *contentOfScrollView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 1, 1130, 125)];
  scrollView.contentSize = CGSizeMake(contentOfScrollView.frame.size.width, contentOfScrollView.frame.size.height);
  
  for (int aantal=0; aantal &lt; 6; aantal++) {
      UIImageView *item = [[UIImageView alloc] initWithFrame:CGRectMake(3+(aantal*188), 0, 185, 125)];
      item.backgroundColor = [UIColor yellowColor];
      UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:item action:@selector(imageTapped:)];
      tap.numberOfTapsRequired = 1;
      tap.cancelsTouchesInView=YES;
      item.userInteractionEnabled = YES;
      [item addGestureRecognizer:tap];
      [contentOfScrollView addSubview:item];
  }
  
  //UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)];
  //[scrollView addGestureRecognizer:tap];
  scrollView.userInteractionEnabled=YES;
  scrollView.delaysContentTouches=NO;
  [scrollView addSubview:contentOfScrollView];
  [self.view addSubview:scrollView];
  </code></pre>
  
  <p>And this is the imageTapped function.</p>
  
  <pre><code>-(void)imageTapped:(UITapGestureRecognizer *)gesture
  {
      NSLog(@"tapped!");
      gesture.view.backgroundColor = [UIColor whiteColor];
  }
  </code></pre>