2011-08-19 19 views

Respuesta

8

puede validar el texto estableciendo el delegado del UITextField a su controlador y luego hacer algo como:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range { 
    [self validateInput]; // Your method to check what the user is writting 
    return YES; 
} 

Y en su "ValidateInput", cambiar la imagen de fondo si falla la validación.

23

cambiar el color de la frontera de un TextField mediante el uso de QuartzCore

#import <QuartzCore/QuartzCore.h> 
[...] 
textField.layer.borderWidth = 1.0f; 
textField.layer.borderColor = [[UIColor redColor] CGColor]; 

con esquinas redondeadas

textField.layer.cornerRadius = 5; 
textField.clipsToBounds  = YES; 
Cuestiones relacionadas