Confirm that you bind the delegate of textfield that you create with the view controller. And use this delegate method :-
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
This will hide the keyboard when return key is pressed.