views:

42

answers:

1

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?

+2  A: 

Check the following:

  1. Is UITextViewDelegate specified in .h
  2. Implement delegate method for uitextview: textViewShouldEndEditing, return YES
  3. make sure your .m (controller) is the delegate for uitextview in IB
  4. resignFirstResponder should now work.
Jordan
This should work. Have done it in some of my apps...
Geoff Baum