JSQmessageviewcontroller:没有尾巴的气泡

JSQmessageviewcontroller: Bubbles without tails

我正在使用 JSQmessageviewcontroller,但我希望气泡没有尾巴,只是圆角矩形,这可能吗?我目前正在做类似的事情:

JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] init];
self.outgoingMessageBubble = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor colorWithRed:0.949 green:0.949 blue:0.949 alpha:1]];

我希望它看起来像:

还有办法调整两个气泡之间的距离吗?

你想要做的是将无尾图像传递到你的 JSQMessagesBubbleImageFactory 中

Objective C:

JSQMessagesBubbleImageFactory *bubbleFactoryOutline = [[JSQMessagesBubbleImageFactory alloc] initWithBubbleImage:[UIImage jsq_bubbleRegularStrokedImage] capInsets:UIEdgeInsetsZero];

Swift:

JSQMessagesBubbleImageFactory(bubbleImage: UIImage.jsq_bubbleCompactTaillessImage(), capInsets: UIEdgeInsetsZero). 

至于让消息之间的距离你只需要改变上标签的高度 objective C:

(CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView
               layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForMessageBubbleTopLabelAtIndexPath:(NSIndexPath *)indexPath
{
    return 0.0f;
}

Swift:

override func collectionView(collectionView: JSQMessagesCollectionView!, layout collectionViewLayout: JSQMessagesCollectionViewFlowLayout!, heightForMessageBubbleTopLabelAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
    return 20
}

Swift 3:

JSQMessagesBubbleImageFactory(bubble: UIImage.jsq_bubbleCompactTailless(), capInsets: .zero)

在Swift3.0

JSQMessagesBubbleImageFactory(bubble: UIImage.jsq_bubbleCompactTailless(), capInsets: .zero)