0

I need to set a static header that is common for all sections in the collection view and since I am using a compositional layout, I can't set a common header like that is usually done in the flow layout collection views.

Using layoutAttributesForSupplementaryViewOfKind:atIndexPath: and sectionHeadersPinToVisibleBounds only works for the specific section and not commonly for the entire set of sections. Repeating the same header for all the sections is inefficient I felt, so is there any way that the headers can be made static effectively?

Dracarys
  • 31
  • 1
  • 9
  • "Repeating the same header for all the sections is inefficient I felt" Not if you use a section provider function. See https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayout/3199214-init – matt May 24 '22 at 11:19
  • I am using multiple sections and hence yes, I am using a section provider closure. But this won't solve the static header requirement I guess. – Dracarys May 26 '22 at 11:05
  • I guess I don't understand what a static header _is_. Can you draw a picture? – matt May 26 '22 at 12:06
  • Assume a table with 5 headers and data filled in 5 columns under each of those headings. now the data cells can be scrolled vertically but the headers should not hide when scrolled from top to bottom. it should stay pinned to top. – Dracarys May 27 '22 at 14:03
  • I would suggest putting the headers in a view outside the collection view. – matt May 27 '22 at 14:11

0 Answers0