自定义JSQMessage气泡外观

时间:2017-03-31 10:18:33

标签: ios user-interface jsqmessagesviewcontroller

是否有一种简单的方法可以删除这些聊天气泡' stalks'从某些消息? (我想将它从不在头像图像旁边的那个中删除)

screenshot

1 个答案:

答案 0 :(得分:0)

Ya只是为tailessBubble创建一个变量,库中包含一个无穷无尽的气泡图像资源

let tailessIncomingBubble = JSQMessagesBubbleImageFactory(bubble: UIImage(named: "tailessMessageBubble"), capInsets: UIEdgeInsets.zero).incomingMessagesBubbleImage(with: WeaveColor.Grey.incomingBubble)

然后只需覆盖messageBubbleImageDataForItemAt方法

override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageBubbleImageDataForItemAt indexPath: IndexPath!) -> JSQMessageBubbleImageDataSource! {
    let currentMessage = messages[safe: indexPath.item]
    return firstMessageInSet(indexOfMessage: indexPath) ? currentMessage?.senderId() == currentUser.senderID() ? tailessOutgoingBubble : tailessIncomingBubble : currentMessage?.senderId() == currentUser.senderID() ? outgoingBubble : incomingBubble
}

如果您需要更多帮助,请告诉我们