Created
April 27, 2012 13:57
-
-
Save emersonbroga/2509498 to your computer and use it in GitHub Desktop.
Emerson Carvalho.com >> iOS esconder o teclado ao tocar fora do UITextField (snippet 3)
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
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
UITouch *touch = [[event allTouches] anyObject]; | |
//Verifique se o seu textField está com o teclado aberto e se o toque foi fora dele. | |
if ([myTextField isFirstResponder] && [touch view] != myTextField) { | |
[myTextField resignFirstResponder]; | |
} | |
[super touchesBegan:touches withEvent:event]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment