I have a grouped table view and trying to set a new first responder to a text field when the user hits enter.
This is nothing new to me, and my code worked before I made some unrelated changes and now it doesn't. I have a pointer to the correct text field when I set its first responder, nothing happens.
Focus goes away entirely from any text field and the keyboard stays on screen. Then both the enter and 'hide keyboard' keys stop functioning until the user re-initiates focus on a text field again.
Here is the code:
- (void)uiTextFieldShouldReturn:(ObjectEditTextField *)uiTextField
{
if ((group.fields.count - 1) > uiTextField.fieldTag)
{
//loop through every table group
for (int i = uiTextField.fieldTag + 1; i < group.fields.count; i++) {
//get whatever field is in the row (not necessarily a text field)
ObjectEditField *field = [group.fields objectAtIndex:i];
// a check if the field is of type UITextField
if (field.propName && field.updateObjectOnEdit == YES && [field isKindOfClass:[UITextField class]]) {
// set the active field
activeField = field;
// adjust the table view offset to make sure the text field is visble
[self setTableViewOffsetForTextField:field];
// obtain a pointer to the textfield object and set it to be the first responder
UITextField *textField = (UITextField *)field;
NSLog(@"field %@", textField.fieldLabel);
if (![textField.field isFirstResponder]) {
[textField.field becomeFirstResponder];
return;
}
break;
}
}
}