2

I have a UICollectionView that is using UICollectionViewFlowLayout to print a grid of cells to the screen. I configured the layout to flow horizontally & now I need to add a header to each section.

My main issue is with the location of the header which is to the left of the section while I want it to be on top of the section (similar to what it would be if the layout was configured to flow vertically).

Is there a way to do that short of creating my own UICollectionViewFlowLayout subclass? and if that's the only way, can someone please point out a good resource on collection views, it seems that most of the tutorials out there are pretty basic.

The solution discussed here only doesn't seem to work and the header still appears to the left of the section.

Community
  • 1
  • 1
Pepe
  • 6,360
  • 5
  • 27
  • 29

1 Answers1

0

Not sure if you've already found a solution but since I didn't find an acceptable answer on stack overflow I thought I'd contribute. The only way that I was able to get the header to lie above the cell was to write my own custom layout that inherited from UICollectionViewFlowLayout. The only thing you'll have to do is override the prepareLayout method so that your header is placed in the position that you want it.

Sam
  • 49
  • 1
  • 3