Created
July 9, 2013 07:35
-
-
Save jlcampana/5955410 to your computer and use it in GitHub Desktop.
Esconder teclado cuando se pulsa Enter y ejecutar algo
This file contains hidden or 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
- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
if([string isEqualToString:@"\n"]) { | |
[textField resignFirstResponder]; | |
return NO; | |
} | |
return YES; | |
} | |
- (BOOL) textFieldShouldEndEditing:(UITextField *)textField | |
{ | |
return YES; | |
} | |
- (void) textFieldDidEndEditing:(UITextField *)textField | |
{ | |
NSString *address = textField.text; | |
if([self.delegate respondsToSelector:@selector(DO_SOMETHING_WITH_TEXT:)]) | |
{ | |
[self.delegate DO_SOMETHING_WITH_TEXT:address]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment