hi i have to text fields i want to move the focus from first text field to another textfield automatically
for this i am using the following code
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
BOOL isValid = YES;
NSInteger insertDelta = string.length - range.length;
if (textField.tag == 0) {
if (textField.text.length + insertDelta >= 8)
{
[txtRxStoreNumber becomeFirstResponder];
if (txtRxStoreNumber.text.length >= 5) {
isValid = NO;
}
}
}else if (textField.tag == 1) {
if (textField.text.length + insertDelta > 5)
{
isValid = NO;
}
else if(textField.text.length + insertDelta == 0) {
textField.text = @"";
[txtRxItemNumber becomeFirstResponder];
isValid = NO;
}
}
return isValid;
}
the first textfield max range is 7 .
it is working but the problem is after entering the 8th character only the cursor focus moving to second text field.
if only 7 characters are entered the focus of cursor is in first text field only.
after entering the 7th character i want to move to focus of cursor to second text field .
can any one please help me how to do that.
the first textfield max range is 7
but:
So I would sugest to change the above line to >= 7