I'm working on an app with a UITextView. I want to replace the return key on the keyboard with the Done key. I've found code for it but then it's for a UITextField and not a UITextView.
Asked
Active
Viewed 7,295 times
1 Answers
13
You can change the return key with the returnKeyType
property
UITextView *textview = [[UITextView alloc] initWithFrame:CGRectMake(0.f, 0.f, 120.f, 40.f)];
textview.returnKeyType = UIReturnKeyDone;
[self.view addSubview:textview];
Regards,
KL94

klefevre
- 8,595
- 7
- 42
- 71
-
I'm getting this one error: expected ',' or ';' before 'initWithFrame' What would I need to do to solve this? – inFever Jan 15 '11 at 22:40
-
@inFever : I forgot some [ ]. I've edited my response. It should work know. – klefevre Jan 15 '11 at 22:57
-
Hmm it's still a return key in my project. Would you mind uploading the code to mediafire or something when you got time? – inFever Jan 15 '11 at 23:04
-
Maybe are you trying to editing some property of an IBOutlet object ? In that case, don't forget to link your UITextView to your delegate... Try my code in a new project, copy it in the viewDidLoad methods of your viewcontroller it'll work. – klefevre Jan 15 '11 at 23:43
-
Yeah now I get a done key but but it adds another TextView in the upper left corner. (This is the textview I'm getting the done key in. And the textview I created still has the normal return key. And yes I did add the delegate and I link the delegate to the text view and the IBOutlet to the text view. Here is the new project i created with the problem: http://www.mediafire.com/?9796p0pu86i1l12 Maybe you know whats wrong. – inFever Jan 16 '11 at 00:32