Using UITextField inside a keyboard app extension

2019-07-07 04:39发布

问题:

I added textfield (keyboardTextField) on top of my custom keyboard. I can select it and enter some text (using my custom keyboard). But it's impossible for me to select the input view of the main app back. This line of code

[keyboardTextField resignFirstResponder];

doesn't work correctly. If someone have any workaround or any ideas, I need your help.

回答1:

I fixed this by adding a button which switches the user input from the UILabel (in my case) to the (normal - iOS) UITextField in Messages f.e.

I check on a BOOL to see where to enter the user selected character.