hello all i have my four textfield for entering password If my password is "1 2 3 4", is there a way to automatically jump to the second box as soon as I enter "1" and so on and so forth?
+3
A:
use a UITextViewDelegate to detect the input and then call becomeFirstResponder on the next text field.
Gary
2010-06-11 04:36:59
+1
A:
you need to make your class conform to UITesxtFieldDelegate and then use delegate method
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if(texField == textfield1)
{
if([textfield1.text isEqualToString: @"1"])
{
[textfield1 resignFirstResponder];
[textfield2 becomeFirstResponder];
}
}
else if(texField == textfield2)
...... // write similar code
}
Text field calls this method whenever user enters some text or delete text from textfield. Also you need to set in your viewdidload method textfield1.delegate=self;
for each textfield you need to call this method. For further details read doc for UITextFieldDelegate.
Ayaz Alavi
2010-06-11 07:48:17
also RTFM first cuz thats very basic.
Ayaz Alavi
2010-06-11 07:50:55