UITextFieldでリターンキーが押された時にキーボードを隠す

iPhoneでUITextFieldを使う際、リターンキー押下時にキーボードを隠したいことがある。
そのような時は、UITextFieldの「Did End On Exit」をIBActionにバインドし、そのIBActionの中で、UITextFieldインスタンスのresignFirstResponderメソッドを呼んでやればよい。


//View.h
@interface View : UIView {
	IBOutlet UITextField *textField;
}

- (IBAction)download: (id)sender;


//View.m
@implementation View
- (IBAction) download: (id)sender {
	[textField resignFirstResponder];
	// あとは自由に。
}
@end