Return to Snippet

Revision: 56694
at April 10, 2012 07:59 by mattogodoy


Initial Code
// Esta funcion es para que cuando el Usuario toque fuera de
// un campo de texto, desaparezca el teclado

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
    UITouch *touch = [[event allTouches] anyObject];

    // Listo los campos de texto
    if ([txtUsuario isFirstResponder] && [touch view] != txtUsuario) {
        [txtUsuario resignFirstResponder];
    }
    
    if ([txtPassword isFirstResponder] && [touch view] != txtPassword) {
        [txtPassword resignFirstResponder];
    }
    [super touchesBegan:touches withEvent:event];
}

Initial URL


Initial Description
Oculta el teclado del iPhone cuando se toca en otro lado de la pantalla que no sea el campo de texto actual.

Initial Title
Ocultar teclado iPhone

Initial Tags


Initial Language
iPhone