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

CollectionView sections support #22

Open
gregbzh opened this issue Mar 2, 2017 · 2 comments
Open

CollectionView sections support #22

gregbzh opened this issue Mar 2, 2017 · 2 comments

Comments

@gregbzh
Copy link

gregbzh commented Mar 2, 2017

multiple sections are not handled by the layout. Best.

@douglas-srs
Copy link

I would like support for sections too :)

@SandipMondal
Copy link

I have implement to support multiple section ,just changed some lime of code in "override open func prepare()" method. Just replace the for loop with the below code;

But I am not able to add Custom Header for section. Please help me to do this. Thanks in advance.

for section in 0 ..< collectionView!.numberOfSections {
for item in 0 ..< collectionView!.numberOfItems(inSection: section) {
let indexPath = IndexPath(item: item, section: section)
let height = cellPadding + staticCellHeight
let frame = CGRect(x: xOffsets[column], y: yOffset[column], width: columnWidth, height: height)
let insetFrame = frame.insetBy(dx: cellPadding, dy: cellPadding)
let attributes = DisplaySwitchLayoutAttributes(forCellWith: indexPath)
attributes.frame = insetFrame
baseLayoutAttributes.append(attributes)
contentHeight = max(contentHeight, frame.maxY)
yOffset[column] = yOffset[column] + height
column = column == (numberOfColumns - 1) ? 0 : column + 1
}
}

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

No branches or pull requests

6 participants