Suppose I have 2 TextFields (TF1 and TF2). I want to automatically change the focus from TF1 to TF2 after the user has entered 3 characters into TF1.
This can be accomplished by responding to the shouldChangeCharactersInRange: message sent to the TextField's delegate.
//-------------------------------------------------------------------------
- (BOOL)textField

UITextField *)textField shouldChangeCharactersInRange:
(NSRange)range replacementString

NSString *)string
{
if (range.location == 2)
{
TF1.text = [TF1.text stringByAppendingString:string];
[textField resignFirstResponder];
[TF2 becomeFirstResponder];
}
}
---------------------------------------------------------------------------
Say, for example, that the last character entered in FT1 is a "6".
The "6" is sent to this method in the string parameter and the fact that it is the 3rd character is recognized by range.location == 2. At this point I append the "6" to the first 2 characters. This works fine except for the fact that that 3rd character ("6") is loaded into TF2 along with the focus. I've worked through all of the TextField "Shoulds and Dids", but haven't been able prevent the last character being loaded into TF2. Nor have I been able to automatically delete it:
????? Thanks. Jack