Skip to content

Instantly share code, notes, and snippets.

@jakemarsh
Created September 22, 2010 19:28
Show Gist options
  • Save jakemarsh/592329 to your computer and use it in GitHub Desktop.
Save jakemarsh/592329 to your computer and use it in GitHub Desktop.
Throw this on your UITableViewDelegate (probably your UITableViewController) to achieve the "keyboard dismisses when I tap away" effect.
//Throw this on your UITableViewDelegate (probably your UITableViewController) to achieve the "keyboard dismisses when I tap away" effect.
//Your users will thank you. A lot.
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[self.view endEditing:YES];
}
//The endEditing: method on UIView comes to us from a category that UITextField adds to UIKit that makes the view or any subview that is the first responder resign (optionally force), that's what the "YES" bit is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment