swiftuicollectionviewuicollectionreusableview

Non sticky header section cell (supplementaryview) on collectionview


Okay so here is the struggle, the default behavior for header section cells is to stick to the top of the collection view frame, did some digging and couldn't find a way to remove this default behavior, if anyone has clues about how to do it, please share.

The main reason for this is that I want to display a header as a UIView on top of the collectionView so if the section header does not scroll with the rest it kinda sucks in terms of UI experience IMO.


Solution

  • Set the flow layout's sectionHeadersPinToVisibleBounds to false.