菜鸟教程小白 发表于 2022-12-12 13:24:55

ios - JSQMessages 反馈定制


                                            <p><p>我正在使用 <strong>JSQMessages</strong> (<a href="https://github.com/jessesquires/JSQMessagesViewController" rel="noreferrer noopener nofollow">https://github.com/jessesquires/JSQMessagesViewController</a>) 在我的应用程序中处理聊天。</p>

<p>我想在 JSQMessages UI 中显示消息是否已传递、消息是否被另一端读取或传递中是否存在问题(与其他聊天应用程序执行的功能相同)。</p>

<p>如何自定义它以显示此信息?我的目标是在邮件无法送达时添加支票、双重支票或红色感叹号。</p>

<p><strong>我有什么想法可以使用 JSQMessages 完成此任务吗?</strong></p>

<p>非常感谢,</p>

<p>丹尼尔</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您可以在 JSQMessage 模型类中添加状态枚举来表示不同的传递状态标志。在您的 JSQMessagesController 子类中,您可以覆盖此方法:</p>

<pre><code>- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellBottomLabelAtIndexPath:(NSIndexPath *)indexPath
</code></pre>

<p>并返回一个与您要显示的传递标志匹配的 NSAttributedString。</p>

<p>请记住,这与后端无关。 JSQMessages 仅用于 UI,因此后端工作必须由您完成。</p>

<p>您可以在这里获得更多信息:
<a href="https://github.com/jessesquires/JSQMessagesViewController/issues/190" rel="noreferrer noopener nofollow">https://github.com/jessesquires/JSQMessagesViewController/issues/190</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - JSQMessages 反馈定制,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/27606912/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/27606912/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - JSQMessages 反馈定制