1

I have a keyboard which edits text in a UITextView and tapping the return key doenst dismiss the keyboard, it only moves down to the next line.

How can I add a done button and make that dismiss the keyboard?

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
some_id
  • 29,466
  • 62
  • 182
  • 304

1 Answers1

3

Implement the

textView:shouldChangeTextInRange

method to look for "\n" then call

resignFirstResponder on the textView if it is found.

Reference

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
Bemmu
  • 17,849
  • 16
  • 76
  • 93