title: Hide Keyboard when user taps outside the text field in UITableView and UIScrollView
body: <p>My UIViewController hierarchy is as follows</p>
  
  <pre><code>UIView
      UIScrollView
          UITableView
              UITableViewCell
                  UITextField
  </code></pre>
  
  <p>The UITableView is added to the view controller programmatically.
  I want to hide keyboard when user taps outside UTTextField either on the view or on the UITableView
  I am executing some methods when user taps on other UITableView rows</p>
  
  <p>I tried </p>
  
  <pre><code>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  </code></pre>
  
  <p>UIScrollView doesn't send the touch events.</p>
  
  <p>I tried adding Tap gesture</p>
  
  <pre><code>UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
  [singleTap setNumberOfTapsRequired:1];
  
  [[self view] addGestureRecognizer:singleTap];
  </code></pre>
  
  <p>but with TapGesture, hides the following event</p>
  
  <pre><code>-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  </code></pre>
  
  <p>are there any other possible ways to hide the keyboard?</p>