Skip to main content
Version: v4

Image Bubble

CometChatImageBubble is the content view for a MediaMessage if the media sent is an image.

Methods

MethodsParametersDescription
set(imageUrl: String)String urlIt used to set image url which to be rendered in image bubble
set(caption: String)String captiona text to display below the image
set(style: ImageBubbleStyle)ImageBubbleStyle styleused to customize appearance of this bubble
setOnClick(onClick: @escaping (() -> Void))@escaping (() -> ())custom action on tapping the image

ImageBubbleStyle

ImageBubbleStyle is the class containing attributes to customize appearance of this bubble.

MethodsTypeDescription
set(captionTextFont: UIFont)UIFontused to set font of the caption of the message
set(captionTextColor: UIColor)UIColorused to set color of the caption of the message
set(background: UIColor)UIColorused to set background color
set(borderColor: UIColor)UIColorused to set a border color
set(borderWidth: CGFloat)CGFloatused to set border
set(cornerRadius: CometChatCornerStyle)CometChatCornerStyleused to set border radius
set(activityIndicatorTint: UIColor)UIColorused to set the activity indicator color

Usage

//create image bubble style object
let imageBubbleStyle = ImageBubbleStyle()

//modify the style properties
imageBubbleStyle.set(activityIndicatorTint: .blue)
imageBubbleStyle.set(borderColor: .black)
imageBubbleStyle.set(captionTextColor: .brown)
imageBubbleStyle.set(captionTextFont: UIFont.systemFont(ofSize: 12.0))
imageBubbleStyle.set(background: .red)
imageBubbleStyle.set(cornerRadius: CometChatCornerStyle(cornerRadius: 5.0))

//set style to the image bubble object
imageBubble.set(style: imageBubbleStyle)