0

I want to make a custom keyboard that types custom emojis instead of just letters and numbers. The following code helps me type just a letter or number

[self.textDocumentProxy insertText:[key currentTitle]];

but if I change "currentTitle" to "currentImage" it does not result in the correct action because "insertText" is not expecting an UIImage. Can anybody help me with this?

Willeke
  • 14,578
  • 4
  • 19
  • 47
VV2020
  • 1
  • 1

1 Answers1

0

Emojis are characters that are represented by images.

[self.textDocumentProxy insertText:""];

If you know the code of the emoji:

[self.textDocumentProxy insertText:[NSString stringWithFormat:@"%C", 0xe04e]];

Davyd Geyl
  • 4,578
  • 1
  • 28
  • 35
  • Hi! I want to add custom emojis, like ones I drew. Is there a way to do that? – VV2020 May 25 '20 at 00:45
  • You can't pass an image through `textDocumentProxy`, which is designed for text. I would try to create a custom subclass of UIInputView, assign it to `inputView` and handle the images through dedicated closures that are designed to pass image types. – Davyd Geyl May 25 '20 at 02:14