gpt4 book ai didi

ios - JSQmessageviewcontroller : Bubbles without tails

转载 作者:可可西里 更新时间:2023-11-01 17:04:58 27 4
gpt4 key购买 nike

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

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

我希望它看起来像:

enter image description here

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

最佳答案

你想要做的是将无尾图像传递到你的 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)

关于ios - JSQmessageviewcontroller : Bubbles without tails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35410567/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com