title: Sibling subview does not receive touches in iPhone
body: <p>I have a view (<code>parent</code>) with two subviews, one on top (<code>topChild</code>) of the other (<code>bottomChild</code>).</p>
  
  <p>If I tap on the screen only <code>topChild</code> and <code>parent</code> receive the touch event.</p>
  
  <p>What should I change to propagate the touch event to <code>bottomChild</code> as well?</p>
  
  <p>The code:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      MYView* parent = [[MYView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
      parent.tag = 3;
      parent.backgroundColor = [UIColor redColor];
  
      MYView* bottomChild = [[MYView alloc] initWithFrame:CGRectMake(0, 0, 90, 90)];
      bottomChild.tag = 2;
      bottomChild.backgroundColor = [UIColor blueColor];
      [parent addSubview:bottomChild];
  
      MYView* topChild = [[MYView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
      topChild.tag = 1;
      topChild.backgroundColor = [UIColor greenColor];
      [parent addSubview:topChild];
      [self.view addSubview:parent];
  }
  </code></pre>
  
  <p>Where <code>MYView</code> is a subclass of <code>UIView</code> that only logs <code>touchesBegan</code>.</p>
  
  <pre><code>- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      NSLog(@"%d", self.tag);
      [super touchesBegan:touches withEvent:event];
  }
  </code></pre>
  
  <p>The result:</p>
  
  <p><img src="https://i.stack.imgur.com/YaSMG.png" alt="enter image description here"></p>
  
  <p>Touching the green area produces the following log:</p>
  
  <pre><code>TouchTest[25062:f803] 1
  TouchTest[25062:f803] 3
  </code></pre>
  
  <p>My first idea was to make <code>parent</code> propagate all the <code>touchesSomething</code> calls to its children but <strong>(A)</strong> I suspect there might be an easier solution and <strong>(B)</strong> I don't know which child sent the event to parent, and sending <code>touchesSomething</code> messages twice to the same view might cause shenanigans.</p>
  
  <p>After asking the question I've found this <a href="http://bynomial.com/blog/?p=74" rel="nofollow noreferrer">post</a> that suggests to override <code>hitTest</code> to change the view that receives the touches. I will try this approach and update the question if it works.</p>