I am trying to make my editable UITextView resign the keyboard (resignFirstResponder) when the user taps “Done.” Using a UITextField, I have been able to do this with the following code:
- (IBAction)doneEditing:(id)sender {
[sender resignFirstResponder];
}
… and then to attach it to the relevant UITextField in Interface Builder to the action “Did End on Exit.”
However, with a UITextView, I can’t seem to access the “Did End on Exit” action. Any suggestions on how to make this happen?
new Answer
On your View, you’d have a UIBarButton (“Done”) that is connected to the IBAction below:
Where textView is your textView outlet defined in your .h file and connected in Storyboard or .xib file. Like this:
old Answer
Check the following:
in .h
for uitextview:
textViewShouldEndEditing, return YES
delegate for uitextview in IB
work.