Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HeaderView/ FooterView for Sections #11

Closed
faris-mobile89 opened this issue Apr 2, 2018 · 2 comments
Closed

Support HeaderView/ FooterView for Sections #11

faris-mobile89 opened this issue Apr 2, 2018 · 2 comments

Comments

@faris-mobile89
Copy link

faris-mobile89 commented Apr 2, 2018

How to add footer or header view for each section.

in Objective C we can use:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {}

@mohamede1945
Copy link
Contributor

mohamede1945 commented Apr 3, 2018

You create a class conforming to SupplementaryViewCreator or use any of its implementation like BasicSupplementaryViewCreator.

Then you assign it to the data source with any of the following methods

/// Sets a header creator.
open func set(headerCreator: SupplementaryViewCreator)

/// Sets a footer creator.
open func set(footerCreator: SupplementaryViewCreator)

/// Sets both header and footer creators.
open func set(headerCreator: SupplementaryViewCreator, footerCreator: SupplementaryViewCreator) 

If you have a one basic data source. Just assign it to it. But if you have a CompositeDataSource(sectionType: .multi), you can assign it to the root composite data source to get the same header and/or footer for all sections or assign different ones to ALL the children to get different headers and/or footers for each section.

@mohamede1945
Copy link
Contributor

Please re-open if that didn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants