I have a UITextView
that receives input from the keyboard. The "Auto Enable Return Key" checkbox is checked, so when the UITextView
is empty the Return key is disabled.
I have an Emoticons bar above the keyboard that can add emoticons to the UITextView
as well, but here's the problem; When the UITextView
is empty and I add an emoticon to the UITextView
like this:
[inputTextView insertText:@"\ue40d"];
then the ReturnKey is still disabled, although the UITextView's text property is not empty.
I've tried this after inserting an emoticon:
[inputTextView setEnablesReturnKeyAutomatically:NO];
With no results. It looks like enabling/disabling the Return Key of the keyboard is only triggered by entering characters through the keyboard.
Any idea's how to do manually enable/disable the Return key?
While on the ANSI keyboard, you can find the return key on the third row, above the right-hand Shift key and below the backslash \ key.
Almost all computer keyboards have a key marked Return or Enter; the two names are synonymous. The Return key moves the cursor (or insertion point) to the beginning of the next line. But more important, it returns control to whatever program is currently running.
Depending on the iOS version your device is running and your keyboard settings, the position of the Return key may vary. Sometimes, you may find it as soon as you launch the keyboard, but in a vast majority of cases, you'll be able to access it from the num pad section by tapping on the “123” key.
It's a bit of a hack, but you could try inserting the text via the pasteboard instead:
UIPasteboard* generalPasteboard = [UIPasteboard generalPasteboard];
// Save a copy of the system pasteboard's items
// so we can restore them later.
NSArray* items = [generalPasteboard.items copy];
// Set the contents of the system pasteboard
// to the text we wish to insert.
generalPasteboard.string = text;
// Tell this responder to paste the contents of the
// system pasteboard at the current cursor location.
[textfield paste: nil];
// Restore the system pasteboard to its original items.
generalPasteboard.items = items;
// Free the items array we copied earlier.
[items release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With