Handling the return key to the iOS 8 keyboard extension

I am working on an iOS 8 keyboard extension, and currently, when a user clicks on my Return key, I am running this code:

[self.textDocumentProxy insertText:@"\n"]; 

This works as expected in most places. However, in the Contacts application, if I edit a contact, select the first name field and press Return, nothing will happen. He does not move to the next field as expected. This contrasts with the default keyboard, which moves to the next field.

Am I doing something wrong?

+5
source share
1 answer

Yes. In fact, each textDocumentProxy will have a UIReturnKeyType. Depending on which method used by your return key needs to be changed.

  typedef NS_ENUM(NSInteger, UIReturnKeyType) { UIReturnKeyDefault, UIReturnKeyGo, UIReturnKeyGoogle, UIReturnKeyJoin, UIReturnKeyNext, UIReturnKeyRoute, UIReturnKeySearch, UIReturnKeySend, UIReturnKeyYahoo, UIReturnKeyDone, UIReturnKeyEmergencyCall, }; 

In your case, skip to the next responder if you see that the current self.textDocumentProxy.returnKeyType returns UIReturnKeyNext

+1
source

Source: https://habr.com/ru/post/1202131/


All Articles