UITapGestureRecognizer only detects parent view tap
<p>I am using UITapGestureRecognizer for detecting which UIView was tapped on my screen but for some reason it only detects the parent view tap, for example below code logs only parent views tag. How do i detect subview taps which are present on main view. Please suggest. </p>

<pre><code>Inside View did load :- 

UITapGestureRecognizer *viewTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionForViewTapped:)];
    [self.view addGestureRecognizer:viewTapRecognizer];
</code></pre>

<p>Method outside view did load. </p>

<pre><code>-(void) actionForViewTapped:(UITapGestureRecognizer*)sender {
    NSLog(@"view tapped");
    UIView *view = sender.view;
    NSLog(@"view tag is %lu", view.tag); //Always prints parent view tag. 

    if(view.tag == 10){
        NSLog(@"tag1 tapped"); //Not called
    }
    if(view.tag == 20){
        NSLog(@"tag 2 tapped"); //Not called
    }
}
</code></pre>