JSQMessagesViewcontroller自定义JSQMediaItem

时间:2015-09-23 03:06:17

标签: jsqmessagesviewcontroller

我正在使用JSQMessagesViewController并且我编写了我的自定义照片和语音MediaItems,它继承了JSQMediaItem,并且这两种消息类型的mediaView是不同的。 发送/接收这两种消息时一切正常,但是当我使用循环加载某些历史消息时,它显示不正确。

screenShot1

似乎所有mediaMessage都重用了第一个mediaMessage的单元格大小。 但是当我发送照片/语音消息时,新发送的消息就会正确显示。

screenShot2

我的cellForItemAtIndexPath方法如下:

override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = super.collectionView(collectionView, cellForItemAtIndexPath: indexPath)
    return cell
}

邮件加载代码:

for msg in msgs {
    let jsqMessage = self.genJSQMessage(msg)
    self.messages.append(jsqMessage)
    self.finishSendingMessageAnimated(true)
}

我真的很困惑,任何意见和建议都将不胜感激!

1 个答案:

答案 0 :(得分:0)

我发现我没有覆盖JSQMediaItem中的mediaHash()函数。

相关问题