我尝试通过将自定义图像传递给 init 方法来更改 JSQMessagesViewController 的默认 MessagesBubbleImage,但它不起作用,这是代码
outgoingBubbleImageView = JSQMessagesBubbleImageFactory.init(bubbleImage: UIImage(named: "bubbleMine"), capInsets: UIEdgeInsetsZero).outgoingMessagesBubbleImageWithColor(UIColor.grayColor())
你好,我一直在研究你的问题,但我已经解决了 Objective C,所以我会将我的答案和翻译发布到 Swift
在 DemoModelData
初始化
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())
请注意,您从中得到的是形状,而不是颜色
希望对你有帮助,对我来说没问题
关于ios - JSQMessagesViewController changedBubbleImage 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38335369/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |