简体   繁体   English

在 InputBarAccessoryView TextField 中处理(或禁用)拟我表情

[英]Handling (or disabling) Memoji in InputBarAccessoryView TextField

I'm building a chat app using MessageKit, Firebase and InputBarAccessoryView pods.我正在使用 MessageKit、Firebase 和 InputBarAccessoryView pod 构建一个聊天应用程序。

I've found out that when I input a Memoji (aka sticker) in the textfield of the InputBar and press the "send" button, in the database the Memoji will be saved as "\n", which of course will be rendered as a blank bubble in the receiving user screen.我发现当我在 InputBar 的文本字段中输入一个拟我表情(又名贴纸)并按“发送”按钮时,在数据库中拟我表情将被保存为“\n”,这当然会呈现为接收用户屏幕中的空白气泡。 The issue is exclusive to Memoji, regular emojis works fine.这个问题是 Memoji 独有的,普通的表情符号可以正常工作。

Before sending, I already check if the user is trying to send an empty string, and if the case the message is not sent at all to the database, but I don't know how to check if a Memoji is being input.在发送之前,我已经检查了用户是否正在尝试发送一个空字符串,如果消息根本没有发送到数据库,但我不知道如何检查是否正在输入表情符号。

Plus, in the textbar the Memoji is rendered awfully, see pic here , so the best solution would be cutting the problem at its roots and removing the option to input Memoji in the textfield or directly removing them from the keyboard.另外,在文本栏中,Memoji 呈现得非常糟糕,请参见此处的图片,因此最好的解决方案是从根本上解决问题并删除在文本字段中输入 Memoji 的选项或直接从键盘上删除它们。

I'm searching for a way to to remove Memoji from users keyboard, or to handle at best these issues, but i've found nothing googling.我正在寻找一种从用户键盘中删除拟我表情的方法,或者充其量处理这些问题,但我没有发现任何谷歌搜索。

Memojis work this way: when selected from the keyboard, they are pasted into the TextView.拟我表情以这种方式工作:当从键盘中选择时,它们会被粘贴到 TextView 中。 So i just found a decent solution directly from the InputBar API:所以我直接从 InputBar API 找到了一个不错的解决方案:

messageInputBar.inputTextView.isImagePasteEnabled = false

This removes the possibility to paste images in the TextView, and alongside Memojis are removed from the keyboard.这消除了在 TextView 中粘贴图像的可能性,并且从键盘中删除了拟我表情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM