Return doesn't dismiss QWERTY keyboard


#1

I’m working on the SIlver challenge and as I do I notice that the question in the book rather implies that the Return key on the QWERTY keyboard will dismiss the keyboard once it is pressed. In fact this doesn’t happen. The Return key doesn’t do anything. Can anyone explain this? Have I missed something? Getting the Number Pad to dismiss of course is another matter!

Thanks

James


#2

Did you set the UITextFields delegate in the xib file to the File’s owner? That’s just off the top of my head, I can’t be sure if the problem is in your code or in your xib.

EDIT:
Unless you post your code I can’t help too much.
Other than that, if you haven’t implemented the textFieldShouldReturn method then you should do that in the DetailViewController.m


#3

The chapter never actually implements this so the return key doesn’t actually do anything. A google search solved the issue and it’s like ssh2690 mentioned.

Set in DetailViewController.h that the class will be a delegate of UITextFieldDelegate

then in DetailViewController.m set up the method for textFieldShouldReturn so that the keyboard properly resigns as the first responder

- (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; }