Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView with "Done" button *and* "Return" key?

I use a UITextView for multiline text entry in my iPhone app, and I have set the "Return" key to display "Done." I've also set up the return key to disable first responder status, so that hitting "done" actually exits the UITextView. However, I also want to enable users to be able to enter multiline text into the UITextView, i.e. to be able to use the "Return" key. Is there any way to make this work on the iPhone/iPad's UI?

like image 554
Jason Avatar asked Nov 17 '10 10:11

Jason


2 Answers

I've been struggling with this issue for 5 years waiting for apple to wake up and create some sort of solution for the textfield multiline responding to done button until I decided to create one myself. there you go:UITextField multiline with hide keyboard option

like image 66
Gal Blank Avatar answered Sep 28 '22 19:09

Gal Blank


It'll be time consuming but you could create your own keyboard with both these keys (this can be done by specifiying the Input View for the UITextView ).

Another alternative could be having a button that sits just above the keyboard that would dismiss the keyboard. You can use the UITextView's Input Accessory View which allows you to create a view that sits on top of the keyboard. See here for more information (I'm aware this document is for iPad but it works for all iOS devices - also just to note, both these require iOS 3.2 or greater).

This should only need to be done on the iphone because the iPad keyboard already comes with a dismiss keyboard button as well as a return button.

like image 43
Luke Avatar answered Sep 28 '22 19:09

Luke