JSQMessagesViewController

JSQMessagesViewController

我正在尝试使用JSQMessagesViewController,并且想从气泡中删除尾巴,以便将它们显示为规则的圆角矩形。我有以下代码用于初始设置:

let imageFactory = JSQMessagesBubbleImageFactory(bubbleImage: UIImage.jsq_bubbleRegularTaillessImage(), capInsets: UIEdgeInsetsZero)
incomingBubbleImageData = imageFactory.incomingMessagesBubbleImageWithColor(incomingColor)
outgoingBubbleImageData = imageFactory.outgoingMessagesBubbleImageWithColor(outgoingColor)

然后:
override func collectionView(collectionView: JSQMessagesCollectionView!, messageBubbleImageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageBubbleImageDataSource! {
        let messagesArray = messagesArrayForSection(indexPath.section)
        let message = messagesArray[indexPath.row]
        if message.senderId == senderId {
            return outgoingBubbleImageData
        }

        return incomingBubbleImageData
    }

这是可行的,可以切断带有文本的气泡的尾巴,但是对于图像,尾巴仍然存在:

ios - JSQMessagesViewController,RegularTaillessImage无法用于图像-LMLPHP

有什么想法我可能在这里做错了吗?任何指针将不胜感激。谢谢!

最佳答案

https://github.com/jessesquires/JSQMessagesViewController/issues/1168#issuecomment-167153451

在JSQMessageBubbleImageFactory.m中,更改以下行:

        -(instancetype)init
        {
         return [self initWithBubbleImage:[UIImage
               jsq_bubbleRegularTaillessImage]
               capInsets:UIEdgeInsetsZero];
        }

关于ios - JSQMessagesViewController,RegularTaillessImage无法用于图像,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36999434/

10-10 03:57