title: Dismissing UIPickerView on tapping background
body: <p>I am adding a uipickerview as the subview of the main view. To dismiss the pickerview on tapping the backgroud view, i am adding a UITapGestureRecognizer to the main view.</p>
  
  <p>I am using the following code to add the GestureRecognizer for main view</p>
  
  <pre><code> UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
      gestureRecognizer.numberOfTapsRequired=1;
      gestureRecognizer.numberOfTouchesRequired=1;
      gestureRecognizer.delegate = self;
      [self.view addGestureRecognizer:gestureRecognizer];
      [gestureRecognizer release];
  </code></pre>
  
  <p>In the handleSingleTap method i am dismissing the pickerview.</p>
  
  <p>But the problem is handleSingleTap is also called when I tap inside the pickerview. To avoid it i used the following delegate method of UIGestureRecognizer</p>
  
  <pre><code> -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
  
      /*
       *If the tap is inside a button return NO, to ensure the button click is detected.
       */
      if ([touch.view isKindOfClass:[UIButton class]]){
          return FALSE;
      }else if([touch.view isKindOfClass:[UIPickerView class]]) {
  
          return FALSE;
  
      }
      return TRUE;
  }
  </code></pre>
  
  <p>It is working for button,But is not working for <code>UIPickerView</code>. Can anyone help me with this?</p>