Created
September 22, 2010 19:28
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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