I have a editable text box and when I click on it I get a keyboard. But, it won't let me close out of the keyboard. When I go into the properties of the editable text object ( the Text View object ) and make the return button "Done" it still won't let me exit out.
Asked
Active
Viewed 2,857 times
2 Answers
1
You should do it programatically, by using resignFirstResponder message on the UITextField is currently being edited with the keyboard. Check this Stack Overflow question on the issue.

Community
- 1
- 1

Pablo Santa Cruz
- 176,835
- 32
- 241
- 292
-
I'm new to this, so I don't know where to put the code you just said. But I'll check out the link thanks! – cat Aug 23 '09 at 12:31
-
I don't really understand what they were saying because i'm new. But I guess I can go on the apple website to see what they mean. – cat Aug 23 '09 at 15:10
0
First, you need to make sure you controller is a UITextField Delegate in your .h- something like this:
@interface UserAddEditController : UIViewController <UITextFieldDelegate>
2nd, you need to implement the following:
- (BOOL)textFieldShouldReturn:(UITextField *) theTextField {
[theTextField resignFirstResponder];
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
[textField resignFirstResponder];
}
Finally, make sure your UITextField's delegate is set to your File Owner in interface builder.
That should do it!

Ali
- 2,163
- 1
- 16
- 18