gpt4 book ai didi

ios - 如何在 Swift 的 JSQMessagesViewController 中添加日期标签

转载 作者:搜寻专家 更新时间:2023-10-31 22:46:39 24 4
gpt4 key购买 nike

我正在尝试向 JSQMessageViewController 添加日期标签,并且我正在实现正确的方法,但没有显示任何内容。这是我的代码:

override func collectionView(collectionView: JSQMessagesCollectionView!, attributedTextForCellBottomLabelAtIndexPath indexPath: NSIndexPath!) -> NSAttributedString! {
let message: JSQMessage = self.messages[indexPath.item]

return JSQMessagesTimestampFormatter.sharedFormatter().attributedTimestampForDate(message.date)
}

谢谢!

最佳答案

我认为您可能还需要重写collectionView:layout:heightForCellBottomLabelAtIndexPath:

根据 source,默认值似乎是 0.0 .

关于ios - 如何在 Swift 的 JSQMessagesViewController 中添加日期标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36942223/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com