title: IOS: hide keyboard on touch UITableView
body: <p>I am new in iOS development. I want to hide the keyboard when tapping outside of a UITextView.
  My TextView is in a cell from an UITableView. The problem is that I have a Toolbar at the top and my buttons doesn't react anymore. I implemented the method "shouldReceiveTouch" but my test is not correct i think. Any ideas? Thank you and sorry for my bad english..</p>
  
  <p><strong>In my ViewDidLoad:</strong></p>
  
  <pre><code>tap = [[UITapGestureRecognizer alloc]
                                 initWithTarget:self
                                 action:@selector(dismissKeyboard)];
  tap.delegate = self;
  [self.view addGestureRecognizer:tap];
  </code></pre>
  
  <p>note: tap is an UITapGestureRecognizer property.</p>
  
  <p><strong>Implemented methods:</strong></p>
  
  <pre><code>- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
     shouldReceiveTouch:(UITouch *)touch {
  
      if ([touch.view isKindOfClass:[UIBarButtonItem class]]) {
          return NO;
      }
      return YES;
  }
  
  -(void)dismissKeyboard {
      [tview resignFirstResponder];
  }
  </code></pre>