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

Table Sections - How to customize them? #37

Closed
andrealufino opened this issue Aug 23, 2016 · 3 comments
Closed

Table Sections - How to customize them? #37

andrealufino opened this issue Aug 23, 2016 · 3 comments
Labels

Comments

@andrealufino
Copy link

Hi! Congratulations for the library, really cool and useful!
I need to create custom section cells, but the question is : how can I do it? I see the TableSection has a headerView property, but I'd like to know how can I customize the info inside my custom section cell and how can I reuse the section header cell.

@maxsokolov
Copy link
Owner

maxsokolov commented Aug 23, 2016

Hey, @andrealufino

Thank you!

If you are talking about this, then it's not yet supported.

But you are able to build headers for your sections like follows:

let header1 = UIView(frame: CGRectMake(0, 0, 100, 50))
header1.backgroundColor = UIColor.redColor()

let header2 = UIView(frame: CGRectMake(0, 0, 100, 50))
header2.backgroundColor = UIColor.greenColor()

let section1 = TableSection()
section1.headerView = header1

let section2 = TableSection()
section2.headerView = header2

You have to create a new header view for each section. You cannot actually reuse header view for now.

Or something like this:

func createHeaderView(color: UIColor) -> UIView {

    let header = UIView(frame: CGRectMake(0, 0, 100, 50))
    header.backgroundColor = color

    return header
}

let section1 = TableSection()
section1.headerView = createHeaderView(UIColor.greenColor())

let section2 = TableSection()
section2.headerView = createHeaderView(UIColor.redColor())

@andrealufino
Copy link
Author

Ok, perfect! Clear!
Go on supporting this awesome library man, it's really cool!

@maxsokolov
Copy link
Owner

@andrealufino thanks! Yeah) I'm gonna improve and support it.

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

No branches or pull requests

2 participants