Closed glassipbel closed 7 years ago
Hey, that's one interesting problem. Before sectionHeadersPinToVisibleBounds
was introduced, I discovered the same problem but for UITableView
. I propose a solution in the example GSKVisibleSectionHeadersViewController
. Try to have a look at that and see if you can replicate it, if not, I will give it a try this week.
Thanks for reporting the issue, let me know about your progress!
Thanks :P The problem is now solved.
Actually i can apply the same solution as the tableview that you suggested, but i believe it could be cleaner. This library is really awesome and i believe that if you could make that fix to work properly without this tweak the library would look even cleaner.
Well, if you could give me a hint about this solution I would be more than glad to apply it, but honestly I don't know right now how to improve it without massive changes to the library.
@kbelter How did you managed to fix this in UICollectionView
? I've got it working half way, but I cannot figure out how to substitute the tableHeaderView
proposed in the solution. I'm currently experiencing same issue if you'd remove tableHeaderView
code from the example. Section header is appearing behind (and up) sketchy header.
@AlexKel Hi! I manage to solve the issue by:
Configuring the stretchy view like this: header.minimumContentHeight = 64 header.maximumContentHeight = 264 header.expansionMode = GSKStretchyHeaderViewExpansionMode.topOnly header.contentShrinks = true header.contentExpands = true header.contentAnchor = GSKStretchyHeaderViewContentAnchor.bottom header.manageScrollViewInsets = false
Adding in the section 0 a UICollectionReusableView (it doesn't matter the content you wont see it) and the height of this header should be CGSize(width: UIScreen.main.bounds.width, height: header.maximumContentHeight - header.minimumContentHeight)
Finally when you add the stretchy header to your collectionview add this line after that: collectionView.addSubview(strechyHeader) collectionView.contentInset.top = strechyHeader.minimumContentHeight
That's it :P
Thanks guys, you're amazing 💯
Thanks @kbelter ! Unfortunately this didn't help me.. I needed the very 1st section header to be visible :) I didn't manage to resolve the issue, but changed my structure to have this small section header view as a subview of a stretchy header. I only have 1 section in my collection view, so this works as expected :)
There is a bug when you use this library for a collectionView: Steps for replicate the bug:
Attach you will find an screenshot. (PS: The header is located in section 1, not in section 0, so this collection view has: 3 rows in section 0 1 header in section 1 5 rows in section 1)