UICollectionView with section headers like a UITableView

emm picture emm · Jan 3, 2014 · Viewed 47.4k times · Source

I have a quick question has anyone been able to successfully create and implement section headers in a CollectionView similar to the headers in a TableView ? I did a lot of research and found snippets of code but no real example from anyone who successfully achieved this. I have a CollectionView of photos, What I am trying to achieve is to group them up in sections depending on the month which they were taken. I have managed to split them up into those sections but all I have now is a blank header right above the start of each section. What I want to do is display the months in those currently blank headers. The same way the letters for each section are displayed in the Tableview that displays the contacts. Thanks for your responses in advance.

Answer

david72 picture david72 · May 9, 2014
  1. Enable the section header/footer view in Storyboard.

  2. Implement collectionView:viewForSupplementaryElementOfKind method.

see This Link