How to add a column header and a row header to mosaic

I am following the tutorial on Custom Collection View layout and need to understand how I can add headers to the Mosaic application (lesson 9 and 10). I need to place custom cells of non-uniform heights placed in columns as in the Mosaic. However, I need to add column and row headers with grid lines.

Thanks

Hi @daystar22, thanks for your first post on the forums!

Your custom layout sounds fairly complex so this might be difficult to answer completely for you however the series of videos that you mentioned should be a good starting point to better understand custom collection view layouts.

Are you able to provide some diagrams that better describe what you are trying to achieve with your custom layout along with some more details?

Thanks,
Liam :+1:

Thanks for your reply. I was trying to implement a week view of a calendar similar to the Mac Calendar. The rows represent time slots. The columns represent days of week. Overlay-ed on top of the grid are cells of events of differing heights representing the time span of the event. While watching the RW course on Mosaic in Custom Collection View, I thought I could implement this scheme. I needed to put in the supplementary views for horizontal and vertical headers. I could not understand how to do it.

I eventually implemented this using a tableview with the cell containing 8 labels in a stack view and as many rows as needed. The first column is narrow for hh:mm weeks go into the header, and events are cells that I calculate and overlay on the grid. I calculate the absolute position when the table is scrolled. There are some other things to do such as deleting all the cells and redrawing when the scroll happens.

It works but I cant help but feel that there is a more appropriate way of doing it such as a collection view with horizontal and vertical supplementary views.

Ahh ok, If you’ve mastered it with UITableView then it’s probably leaving it as it is and only coming back to it if you ever need to enhance it further :slight_smile:

I do wonder if iOS 9’s sectionHeadersPinToVisibleBounds property on UICollectionViewLayout would have been able to help though?