首页 > 解决方案 > 如何使用可以键入图像的 Objective-C 制作自定义键盘

问题描述

我想制作一个自定义键盘来输入自定义表情符号,而不仅仅是字母和数字。下面的代码帮助我只输入一个字母或数字

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

但是如果我将“currentTitle”更改为“currentImage”,它不会导致正确的操作,因为“insertText”不需要 UIImage。有人可以帮我吗?

标签: objective-cuiinputviewcontroller

解决方案


表情符号是由图像表示的字符。

[self.textDocumentProxy insertText:""];

如果您知道表情符号的代码:

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


推荐阅读