0

I want to display enter key on keyboard instead of return key. Because i want user to type in a texView. We know that there is no keypad return in textView. Generally, i want to replace the "return" key with "enter". Normally in textView, the return key works as enter. So i need the return key labeled as enter. Is it possible?

Soorej Babu
  • 350
  • 2
  • 19

3 Answers3

2

You can't set Enter But You can set a numbers of default key for keyboard instead of return from storyboard.In you scenario Done will be nice.

see in image

Govind Prajapati
  • 957
  • 7
  • 24
1

Try using the returnKeyType attribute:

UITextField *textField = [[UITextField alloc] init];
textField.returnKeyType = UIReturnKeyTypeDone

Here are the available options:

typedef NS_ENUM(NSInteger, UIReturnKeyType) {
    UIReturnKeyDefault,
    UIReturnKeyGo,
    UIReturnKeyGoogle,
    UIReturnKeyJoin,
    UIReturnKeyNext,
    UIReturnKeyRoute,
    UIReturnKeySearch,
    UIReturnKeySend,
    UIReturnKeyYahoo,
    UIReturnKeyDone,
    UIReturnKeyEmergencyCall,
    UIReturnKeyContinue NS_ENUM_AVAILABLE_IOS(9_0),
};
dpigera
  • 3,339
  • 5
  • 39
  • 60
  • then can i add an extra attribute as UIReturnKeyEnter? – Soorej Babu Apr 06 '16 at 08:30
  • 1
    @soorejbabu if you see the word ENUM in a property, it means you're restricted in choices. Hence, you can only use one from the list above. I would therefore maybe use 'UIReturnKeyDone', as that's the closest one. – dpigera Apr 06 '16 at 15:31
  • oh... ok ok. i got it. i used the UIReturnKeyDefault. – Soorej Babu Apr 07 '16 at 11:48
1

You cannot set custom text for the return key on iOS. There are a number of options but those are the only ones.

Yatendra
  • 1,310
  • 1
  • 18
  • 31