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
How to add custom footer view on channel list? (UIView ver.)
Customer request
Please provide a code sample that demonstrates to the customer how to extend the ChannelListViewController to add a custom component to the bottom of the view controller.
Guide & Snippet
The logic below is a custom snippet with a simple example.
Create a CustomChannelListFooterView class that inherits from UIView.
SBUViewLifeCycle is used for the view life cycle used by SendbirdUIKit. It is not required, so you can configure your view without it if you want.
To customize SBUGroupChannelListModule.List, inherit from this class to create a CustomGroupChannelModule.List class.
The CustomGroupChannelModule.List class is configured to put a CustomChannelListFooterView in the listComponent.
classCustomGroupChannelModule{classList:SBUGroupChannelListModule.List{// You can create a CustomView based on a UIView like this and use it.public lazy varcustomFooterView=CustomChannelListFooterView()overridefunc setupViews(){
super.setupViews()// Creates the `customFooterView`self.addSubview(self.customFooterView)}overridefunc setupLayouts(){
super.setupLayouts()// Sets the `customFooterView` layoutself.customFooterView
.sbu_constraint(equalTo:self, leading:0, trailing:0, bottom:0).sbu_constraint(height:50)// Deactivates the existing bottonConstraint of the tableView.
if let tableViewBottomConstraint =self.constraints.first(where:{
$0.firstAttribute ==.bottom && $0.firstItem ===self.tableView
}){
tableViewBottomConstraint.isActive = false
}// Set the tableView's bottonConstraint to tableViewBottomConstraintself.tableView.sbu_constraint_equalTo(
bottomAnchor:self.customFooterView.topAnchor,
bottom:0)}}}
Before using a customized viewController class, please set it in the SBUModuleSet.
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
Customer request
ChannelListViewController
to add a custom component to the bottom of the view controller.Guide & Snippet
The logic below is a custom snippet with a simple example.
Create a
CustomChannelListFooterView
class that inherits fromUIView
.SBUViewLifeCycle
is used for the view life cycle used by SendbirdUIKit. It is not required, so you can configure your view without it if you want.SBUGroupChannelListModule.List
, inherit from this class to create aCustomGroupChannelModule.List
class.CustomGroupChannelModule.List
class is configured to put aCustomChannelListFooterView
in the listComponent.SBUModuleSet
.Result
Reference
Beta Was this translation helpful? Give feedback.
All reactions