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.
Changing the return key to a done key on the iPhone Keyboard (UITextView)
Asked Answered
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
I'm getting this one error: expected ',' or ';' before 'initWithFrame' What would I need to do to solve this? –
Valenciavalenciennes
@Valenciavalenciennes : I forgot some [ ]. I've edited my response. It should work know. –
Higgins
Hmm it's still a return key in my project. Would you mind uploading the code to mediafire or something when you got time? –
Valenciavalenciennes
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. –
Higgins
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: mediafire.com/?9796p0pu86i1l12 Maybe you know whats wrong. –
Valenciavalenciennes
© 2022 - 2024 — McMap. All rights reserved.