HKTextview表情符号检测(HKTextview emoji detection)

编程入门 行业动态 更新时间:2024-10-28 15:21:23
HKTextview表情符号检测(HKTextview emoji detection)

我有一个问题。 我在应用程序中使用Hakawai框架 ,以便我可以提及支持(@username)。

我遇到的问题是我正在使用的文本字段没有注册没有文本和用户在textview中键入表情符号的情况。 当我们使用HKWTextView ,我相信即使实现了HKWTextView委托方法也不会被调用。 我能想到的唯一替代品是:

- (void)textView:(HKWTextView *)textView didChangeAttributedTextTo:(NSAttributedString *)newText originalText:(NSAttributedString *)originalText originalRange:(NSRange)originalRange;

在HKWTextView ,但是在没有其他文本的情况下,仍然没有找到输入的表情符号。

我想要的功能是: - 文本视图为空 - 用户输入任何内容,包括表情符号 - textview width缩短,出现“Post”按钮。

现在,在空文本视图中键入emojis将不会显示post按钮。 但是,值得一提的是,一旦键入了表情符号,如果有多个,删除其中一个将会显示发布按钮。 我在这里有点不知所措。

I'm having an issue. I am using the Hakawai framework in an app so that I can have mention support (@username).

The issue I've run into is that the textfield I am using is not registering the case where there is no text and a user types an emoji into the textview. As we are using HKWTextView, I believe the textViewShouldChangeTextInRange delegate method is never called, even if implemented. The only replacement I can think to use is :

- (void)textView:(HKWTextView *)textView didChangeAttributedTextTo:(NSAttributedString *)newText originalText:(NSAttributedString *)originalText originalRange:(NSRange)originalRange;

in HKWTextView, but that's still not picking up on emojis being typed in when no other text has.

The functionality I would like is: - Text view is empty - user types in anything, emoji included - textview width shortens, "Post" button appears.

Right now, typing emojis into the empty text view will not make the post button appear. However, it's worth mentioning that once the emojis are typed in, if there is more than one, deleting one of them WILL make the post button appear. I'm at a bit of a loss here.

最满意答案

我找到了答案 - 事实证明,HKWTextView会对触发的UITextView委托方法进行一些重新布线。 尝试处理UITextView委托方法textViewDidChangeSelection中的输入。 键入表情符号时将触发该方法。

I found the answer to this - It turns out that HKWTextView does some rewiring of the UITextView delegate methods that are fired. Try handling the input in the UITextView delegate method textViewDidChangeSelection. That method will be fired when an emoji is typed.

更多推荐

本文发布于:2023-08-03 12:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390548.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表情符号   HKTextview   detection   emoji

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!