Set the delegate on the text field that will bring up the keyboard. Add the following selector to the object that you set to be the delegate.
The controller's interface code#import @interface MyViewController : UIViewController { IBOutlet UITextField *textField;}@property (nonatomic, retain) UITextField *textField;@endAnd the controller's implementation code#import "MyViewController.h" @implementation MyViewController @synthesize textField;-(BOOL)textFieldShouldReturn:(UITextField *)theTextField { if (theTextField == textField) { [textField resignFirstResponder]; } return YES;}@end