views:

995

answers:

2

Hi,

When using a UITextfield to enter information a keyboard pops up on the iphone simulator, the information with it says it will disappear again when return is pressed but it does not.

is there a line of code I need to add so that it will disappear again or is this a querk with the simulator??.

Carl.

A: 

Check this Stack Overflow question out. It has everything you need to solve your problem.

Pablo Santa Cruz
A: 

If you set up your text field similar to this:

UITextField *textField = [[UITextField alloc]initWithFrame:CGRectZero];
...
textField.returnKeyType = UIReturnKeyDone;

you can see some of the basic options. I suspect that you might be missing the returnKeyType = UIReturnKeyDone. By default the return key will not behave this way.

Alternatively, if you resignFirstResponder the keyboard will go away, as others suggest. It sounds like you want the Return key in the keyboard to do this though.

marcc