在 iOS 个应用程序的键盘上仅显示一部分表情符号

Presenting just a subset of emojis on the keyboard on iOS apps

我正在制作一个应用程序,我使用 "People" 表情符号作为头像,使用 "Food and drink" 表情符号作为食物和饮料图标。我想使用常规键盘来呈现用户输入的表情符号,但我只想呈现这两类表情符号(即便如此,每个类别都会在不同的上下文中呈现)。

我正在使用 iOS 8、Xcode 6.3 和 Swift。

我可以配置常规键盘,使其只显示我定义的表情符号子集吗?

如果没有,我可以创建一个新的自定义键盘,保留原始 Apple 键盘的所有内容但限制字符子集吗?关于如何执行此操作的任何指示?

谢谢。

您无法将常规键盘配置为仅显示表情符号的子集。但是是的,可以制作您自己的自定义键盘。

您可以找到一些关于如何制作自定义键盘的非常好的帖子:

我还找到了这个 FaceBoardPlus 示例:http://code4app.net/ios/FaceBoardPlus/52a9ba56cb7e841e178b69d0 这正是您要查找的内容,但写在 objective c.

编辑: From iOS developer library

After a user chooses a custom keyboard, it becomes the keyboard for every app the user opens. For this reason, a keyboard you create must, at minimum, provide certain base features. Most important, your keyboard must allow the user to switch to another keyboard.

To provide a fully custom keyboard for just your app or to supplement the system keyboard with custom keys in just your app, the iOS SDK provides other, better options. Read about custom input views and input accessory views in Custom Views for Data Input in Text Programming Guide for iOS.