It's possible to customize UICollectionView for displaying few sections like one?
-
21-12-2019 - |
Question
I have three different kind of objects that I want to display in collection view. But if in section 0 is only 1 element, next section starts from new column.
Can I tell to the layout that it should show items in different sections one after the other with no breaks?
Solution 2
My solution is to use 1 section and create methods for determinate abstract sections. In addition, I add -infoItemsCount, -visibleItemsCount and -hiddenItemsCount and same methods for generating cells and other.
OTHER TIPS
Sure, but if that never changes, why not make two side-by-side sub views? The left one contains the one element, the right one contains the collection view you originally planned to use.
That way the layout doesn't need to know how to work around the left element.
Additionally, you can use one data source. Make datasource[0]
the left one,
And use datasource[indexPath.row +1]
for the whole cellForRow.....
method.
Just remember to set total cells in the collection view to [datasource count] -1