Question

I have a text field that is apparently successfully calling delegate methods as the following method fires when I tap on the test field, but no keyboard shows.

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    NSLog(@"should begin editing");

    return YES;
}

Any ideas as to why?

A couple of details: This text field happens to be in a view controller in a storyboard. The first time I segue to this view the text field works fine. The subsequent times I segue to this view it does not work. I imagine this is a big clue to why I am getting the described behavior, but I have not been able to figure it out yet.

Was it helpful?

Solution

I fixed the issue by adding the code below to the prepareForSegue: method. Seems to work.

if (_textField.isFirstResponder) {
    [_textTextField resignFirstResponder];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top