I'd like to build a collection view layout something similar to grid. With
- Row containing sub rows
- Columns containing sub columns
- Rows with variable height.
- Scrolling should be possible in both directions.
- It should be possible to add/delete row/columns
I tried using collection flow layout but It started becoming complex. Building a custom layout seems a better option to me.
A few problem faced by me :-
- Data structure(Basic class hierarchy) to store grid information(layout only) that supports easy addition/deletion of rows and columns.
- Calculating height of content view given that the rows can be of variable size.
- Calculating row range that will lie within the visible rect. Right now i to have collect the height information for all the rows and store them in an array and further calculate the content size height. Also to decide which all rows lie within the given rect, I have to apply a predicate. Doing so on every call to "layoutAttributesForElementsInRect" also drops the fps when the no of rows is 500+ still acceptable.
- I tried maintaining an NSSet of layout attributes for visible rows and columns and purging/adding attributes as rows/columns move in and out. but this was more slower the creating each and every attributes for visible items. Also What design patterns are best suited for grids?
- Last but not the least will it be possible to design something like this with UICollectionView?
Any ideas on how to process with this,
thanks :)