Search code examples
iosswiftjsqmessagesviewcontroller

JSQMessages custom cell height does not update


I need to add two buttons to my bubble. For now I added one in the xib file of the bubble but the height of the bubble does not increase. The only thing I see is this:

when my xib looks like this:

enter image description here

The button should be bigger. If i give it a height constraint of 30 for example this happens:


Solution

  • So, what I did in the end was this:

    I added my button right below the textview inside the bubble container. I set the height to 30 and I also added this to my code in my View Controller:

    override func collectionView(_ collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForCellBottomLabelAt indexPath: IndexPath!) -> CGFloat {
        return 30
    }