I have custom keyboard extension with UITextField in it. I am able switch to UITextField
's text input, but cannot switch back to self.textDocumentProxy
. Does anybody know, how to do something like [self.textDocumentProxy becomeFirstResponder]
?
(By the way, it looks like "GIF Keyboard" app provides such possibility)
I've implemented next workaround for this:
My
textFied
inherits fromUITextField
.UserInteraction
disabled to prevent it frombecomeFirstResponder
(because you are not able switch back to system input). I've added blinkingUIView
as cursor imitation (blinking animation). Change this cursororigin.x
in overwritedsetText:
method by calculating length of current string (useboundingRectWithSize:
method for this).When user types something I am checking if
textField
is active (showed) and then adding/removing symbols totextField
(withsetText:
) orself.textDocumentProxy
insertText:
/deleteBackward
methods accordingly.