Skip to main content
Version: v4

Avatar

The CometChatAvatar component displays user and group avatars. For users and groups , it displays either an image or the user's avatar and falls back to the first two letters of the username.

Methods

MethodsDescription
set(cornerRadius : CGFloat)Sets the cornerRadius
set(borderColor : UIColor)Sets the borderColor
set(backgroundColor : UIColor)Sets the backgroundColor
set(borderWidth : CGFloat)Sets the borderWidth
setAvatar(avatarUrl: String)Sets the avatarUrl
setAvatar(avatarUrl: String, with name: String)Sets the avatarUrl with user name initials
set(outerView: Bool)Enables the outerView
set(font : UIFont)Sets the font for Initials
set(fontColor: UIColor)Sets the text color for Initials

Usage of Methods

avatar.set(cornerRadius : 50)
.set(borderWidth : 2)
.set(borderColor: [UIColor: red galaxy color])
.setAvatar(user: user.avatar)
.setOuterViewSpacing( ... )
.setOuterView ( Color: black )
avatar.set(outerView : NO)
.set(cornerRadius : 50)
.set(text: ....)
.set(textColor: ...)
.set(textFont: ...)
.setAvatar(user: user.avatar)
.setAvatarWith (100)
.setAvatarHeight(100)
.setAvatarBackgroundColor (UIColor.blackColor)