title: Understanding resignFirstResponder with UITextField
body: <p>I'm trying to get rid of the keyboard when the user touch outside my UITextField, by using this method:</p>
  
  <pre><code>- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      [mainTextController resignFirstResponder];
      [super touchesBegan:touches withEvent:event];
  }
  </code></pre>
  
  <p>However, this seems to call a method that is called after pressing the return button on the keyboard, but I just want the keyboard to vanish, not to press return for me.
  How can I accomplish that?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: tGilani's answer is the most straight-forward way, works like a charm, without changing to UIControl. But I guess jonkroll's answer also works.</p>