2

I try to change the default MessagesBubbleImage of JSQMessagesViewController by passing custom image into init method, but it's not working, here is the code

outgoingBubbleImageView = JSQMessagesBubbleImageFactory.init(bubbleImage: UIImage(named: "bubbleMine"), capInsets: UIEdgeInsetsZero).outgoingMessagesBubbleImageWithColor(UIColor.grayColor())
Reinier Melian
  • 20,519
  • 3
  • 38
  • 55
bikram sapkota
  • 1,106
  • 1
  • 13
  • 18

1 Answers1

0

Hello I had been working on your question but I had resolved on Objective C, so I will post my answer and a translation to Swift

On DemoModelData Init

JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] initWithBubbleImage:[UIImage imageNamed:@"bubbleMine"] capInsets:UIEdgeInsetsZero layoutDirection:UIUserInterfaceLayoutDirectionRightToLeft];

self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor grayColor]];

Swift Translation

let bubbleFactory = JSQMessagesBubbleImageFactory(bubbleImage: UIImage(named: "bubbleMine")!, capInsets: UIEdgeInsetsZero, layoutDirection: .RightToLeft)

self.outgoingBubbleImageData = bubbleFactory.outgoingMessagesBubbleImageWithColor(UIColor.grayColor())
self.incomingBubbleImageData = bubbleFactory.outgoingMessagesBubbleImageWithColor(UIColor.jsq_messageBubbleGreenColor())

Note that the shape is what you get from this, not the color

I hope this helps you, for me works ok

Reinier Melian
  • 20,519
  • 3
  • 38
  • 55