Question

I have an issue with the new Xcode 4.5 and iOS6. I have a form in my app with various textfields and pickers. I usually navigate through them with the Next key on the onscreen keyboard or pressing tab on my Mac, it seems something new affected the first responder because it doesn't work anymore:

-(UIResponder *)ValidarTextFieldwithCell:(UICellRegister *)Cell{
UIResponder* nextResponder;
UICellRegister *cell2;
NSIndexPath *nextIndexPath = [self nextIndexPath:Cell.MyIndexpath];
cell2= (UICellRegister *)[self.tableView cellForRowAtIndexPath:nextIndexPath];
nextResponder = cell2.Valor;
return nextResponder;
}


- (BOOL)textFieldShouldReturn:(UITextField *)textField   {


UICellRegister *myCell=(UICellRegister *)[[textField superview]superview];

UIResponder* nextResponder;


nextResponder = [self ValidarTextFieldwithCell:myCell];
if (nextResponder) {
    [nextResponder becomeFirstResponder];
} else {
    [textField resignFirstResponder];
    if ([self.parentViewController respondsToSelector:@selector(next:)]) {
        [((RegistroViewController *)self.parentViewController) next:nil];
    }
    if (![self.parentViewController isKindOfClass:[RegistroViewController class]]) {
        [self doneButtonPressed:nil];
    }
    [self animateView:NO withTextfield:nil];
    //        [self doneButtonPressed];
}
    return NO; // We do not want UITextField to insert line-breaks.
}

I'll appreciate any help.

Was it helpful?

Solution

I managed to resolve the issue. I had overridden the textFieldEndEditing method (because of validations that are made of the current cell) that reloads the tableview at the end, the problem resided in that the tableview reloading was the cause of the next field not becoming the first responder. The solution was reloading only the cell I was validating.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top