我尝试通过将自定义图像传递给init方法来更改JSQMessagesViewController的默认MessagesBubbleImage,但它不起作用,这里是代码
outgoingBubbleImageView = JSQMessagesBubbleImageFactory.init(bubbleImage: UIImage(named: "bubbleMine"), capInsets: UIEdgeInsetsZero).outgoingMessagesBubbleImageWithColor(UIColor.grayColor())
答案 0 :(得分:0)
您好我一直在处理您的问题,但我已经解决了Objective C,所以我会将我的答案和翻译发布到Swift
在DemoModelData
Init
JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] initWithBubbleImage:[UIImage imageNamed:@"bubbleMine"] capInsets:UIEdgeInsetsZero layoutDirection:UIUserInterfaceLayoutDirectionRightToLeft];
self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor grayColor]];
快速翻译
let bubbleFactory = JSQMessagesBubbleImageFactory(bubbleImage: UIImage(named: "bubbleMine")!, capInsets: UIEdgeInsetsZero, layoutDirection: .RightToLeft)
self.outgoingBubbleImageData = bubbleFactory.outgoingMessagesBubbleImageWithColor(UIColor.grayColor())
self.incomingBubbleImageData = bubbleFactory.outgoingMessagesBubbleImageWithColor(UIColor.jsq_messageBubbleGreenColor())
请注意,形状是你从中得到的,而不是颜色
我希望这可以帮助你,因为我工作正常