0

I am wondering what the best approach for dismissing a keyboard is when using a UITextView. At the minute for UITextFields I dismiss the keyboard when the return button is pressed. However for the TextView I want to have the return button actually add new lines so there is no additional buttons remaining to close.

What if any is the current "standard" approach for dealing with this issue? For example is it to add an additional button on the screen or is there another approach?

Thanks

ORStudios
  • 3,157
  • 9
  • 41
  • 69
  • You can use https://github.com/hackiftekhar/IQKeyboardManager it will work for textfield and textview as well – kb920 Jan 30 '16 at 04:35

1 Answers1

3

On the iPad there is a "dismiss" button on the keyboard. For iPhones, add an inputAccessoryView to the UITextView. Put a "dismiss" button there.

If you have several fields (text fields, text views, etc.) in some sort of form, you could have a standard inputAccessoryView for all of them. Include a "Next" button (to go to the next field) and a "Done" button (to dismiss the keyboard).

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • See http://stackoverflow.com/questions/21635094/dismiss-iphone-uitextview-keyboard for one implementation. – rmaddy Jan 30 '16 at 00:03