How to reset keyboard for an entry field?
- by David.Chu.ca
I am using tag field as a flag for text fields text view fields for auto-jumping to the next field:
- (BOOL)findNextEntryFieldAsResponder:(UIControl *)field {
BOOL retVal = NO;
for (UIView* aView in mEntryFields) {
if (aView.tag == (field.tag + 1)) {
[aView becomeFirstResponder];
retVal = YES;
break;
}
}
return retVal;
}
It works fine in terms of auto-jumping to the next field when Next key is pressed. However, my case is that the keyboards are different some fields. For example, one fields is numeric & punctuation, and the next one is default (alphabetic keys). For the numeric & punctuation keyboard is OK, but the next field will stay as the same layout. It requires user to press 123 to go back ABC keyboard.
I am not sure if there is any way to reset the keyboard for a field as its keyboard defined in xib? Not sure if there is any APIs available? I guess I have to do something is the following delegate?
-(void)textFieldDidBegingEditing:(UITextField*) textField {
// reset to the keyboard to request specific keyboard view?
....
}
OK. I found a solution close to my case by slatvik:
-(void) textFieldDidBeginEditing:(UITextField*) textField {
textField.keyboardType = UIKeybardTypeAlphabet;
}
However, in the case of the previous text fields is numeric, the keyboard stays numeric when auto-jumped to the next field. Is there any way to set keyboard to alphabet mode?