gpt4 book ai didi

objective-c - jsqmessageviewcontroller 中 customMediaItem 的边距

转载 作者:行者123 更新时间:2023-11-30 13:35:18 25 4
gpt4 key购买 nike

我有一个扩展的类:JSQLloadingPhotoMediaItem,一切正常,预计在我的聊天中我不使用图像作为气泡,但我在气泡内有一个背景颜色和textView的半径,如果我使用该类,我会得到这个:

enter image description here

第一个是具有彩色背景的单元格的 TextView ,第二个是我使用以下代码从类返回的 View :

view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 38))
view!.backgroundColor = UIColor(red:0.89, green:0.98, blue:0.78, alpha:1)
view!.layer.cornerRadius = CGFloat(9)
view!.layer.masksToBounds = true

在函数中

override func mediaView() -> UIView!

如何为我的自定义类提供相同的右边距?或者例如是否想要自定义类居中对齐的 View ?

谢谢!

最佳答案

我也遇到了同样的问题。为了让气泡获得相同的边距,我在自定义媒体 View 中使用了 JSQMessagesMediaViewBubbleImageMasker.h 中的相同 JSQMessagesMediaViewBubbleImageMasker

//apply mask to your view
[JSQMessagesMediaViewBubbleImageMasker applyBubbleImageMaskToMediaView:view isOutgoing:self.appliesMediaViewMaskAsOutgoing];

您可以创建一个 JSQMessagesMediaViewBubbleImageMasker 类别并根据需要扩展它,在特殊情况下,我需要气泡边框的特定颜色。

关于objective-c - jsqmessageviewcontroller 中 customMediaItem 的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36138342/

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