You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenChannelMessageCell consists of the following inheritance structure.
SBUOpenChannelBaseMessageCell
SBUOpenChannelContentBaseMessageCell
SBUOpenChannelAdminMessageCell
SBUOpenChannelFileMessageCell
SBUOpenChannelUserMessageCell
SBUOpenChannelUnknownMessageCell
This section describes how to customize user messages as a representative example.
In general, it is recommended to inherit the User, File, and Aadmin message cells for customization.
Create a custom cell class that inherits from SBUOpenChannelUserMessageCell.
And implement where you need to customize
classMyOpenChannelMessageCell:SBUOpenChannelUserMessageCell{overridefunc configure(
_ message:BaseMessage,
hideDateView:Bool,
groupPosition:MessageGroupPosition,
isOverlay:Bool= false
){// If you need configuring default settings, call super.configure()// Customize your cell}}
Create a Custom ListComponent class that inherits from SBUOpenChannelModule.List.
Then register the custom cell you created on setupViews method.
Customize the tableView(_:cellForRowAt:) function if you need to.
classMyOpenChannelModuleList:SBUOpenChannelModule.List{overridefunc setupViews(){// register your customized cellself.register(userMessageCell:MyOpenChannelMessageCell())// call super.setupViews() to setup default views
super.setupViews()}overridefunc tableView(_ tableView:UITableView, cellForRowAt indexPath:IndexPath)->UITableViewCell{letcell= super.tableView(tableView, cellForRowAt: indexPath)// If necessary, you can customize the behavior as shown below logic.
switch cell {caseletmessageCell as SBUOpenChannelUserMessageCell:
messageCell.userNameView.isHidden = true
default:
break
}return cell
}}
Then, you should update SBUModuleSet.OpenChannelModule.ListComponent to the customized list component:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
Guide & Snippet
OpenChannelMessageCell consists of the following inheritance structure.
SBUOpenChannelBaseMessageCell
SBUOpenChannelContentBaseMessageCell
SBUOpenChannelAdminMessageCell
SBUOpenChannelFileMessageCell
SBUOpenChannelUserMessageCell
SBUOpenChannelUnknownMessageCell
This section describes how to customize user messages as a representative example.
In general, it is recommended to inherit the User, File, and Aadmin message cells for customization.
Create a custom cell class that inherits from
SBUOpenChannelUserMessageCell
.And implement where you need to customize
SBUOpenChannelModule.List
.setupViews
method.tableView(_:cellForRowAt:)
function if you need to.SBUModuleSet.OpenChannelModule.ListComponent
to the customized list component:Beta Was this translation helpful? Give feedback.
All reactions