BouncyLayout icon indicating copy to clipboard operation
BouncyLayout copied to clipboard

Does not respect Header Views

Open AppDevGuy opened this issue 7 years ago • 11 comments

Hi, thanks for a great and very simple to implement feature. I have only one issue - I wish the have sections yet the section headers are not being respected.

With the following line implemented:

self.collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)

The CollectionView does not show my custom header view for each section.

ezgif com-video-to-gif

Without that line, the header is displayed fine.

ezgif com-video-to-gif 1

Any thoughts or suggestions? Kind regards

AppDevGuy avatar May 05 '17 16:05 AppDevGuy

🤔 I will look into this.

roberthein avatar May 07 '17 09:05 roberthein

+1

oferRounds avatar May 08 '17 02:05 oferRounds

+1

ll9750 avatar May 15 '17 11:05 ll9750

Hi all, has anyone found a solution to this?

oferRounds avatar May 26 '17 16:05 oferRounds

I'm running into the same Problem. Has anyone found a solution yet?

magicmikek avatar Aug 30 '17 16:08 magicmikek

Thanks for the repo.

I also found this issue.

After gives the header a size, layout.headerReferenceSize = CGSize(width: UIScreen.main.bounds.width, height: 90), the header shows.

but the header's content like labels will disappear after scroll to bottom with a bouncy. the protocol viewForSupplementaryElementOfKind did not callback

Lately I set the layout.sectionHeadersPinToVisibleBounds = true makes it keep showing, no idea is it has some side effects.

LeiHao0 avatar Jun 01 '18 05:06 LeiHao0

+1 I also see this issue and in my app the first item after the header renders invisible when I use this layout. It is fine when I do not.

Is this library being supported anymore? I sure would like to use it :-)

David-Pyxis-Designs avatar Jul 24 '18 15:07 David-Pyxis-Designs

Yes it is @David-Pyxis-Designs I'll have a look at this issue asap! ✌️

roberthein avatar Jul 25 '18 07:07 roberthein

Thanks @roberthein

david-koneksa avatar Jul 27 '18 02:07 david-koneksa

This solves the issue by not applying animations when a header in in the visible rect:

open override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { let items = animator.items(in: rect) as? [UICollectionViewLayoutAttributes] if (items?.filter({$0.representedElementKind == UICollectionElementKindSectionHeader}).count)! > 0 { return super.layoutAttributesForElements(in: rect) } return items }

Not ideal but visually it is not all that bad Would love the REAL solution though

EDIT: After more testing the issue is still happening sometimes .. .depending on scroll speed it seems

David-Pyxis-Designs avatar Aug 01 '18 17:08 David-Pyxis-Designs

@roberthein have you had a chance to look into this?

conanm avatar Nov 13 '18 06:11 conanm