Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView: How to define a UICollectionViewLayout that supports horizontally and vertically scrolling?

Tags:

People also ask

How do I make my UICollectionView scroll horizontal?

You need to reduce the height of UICollectionView to its cell / item height and select " Horizontal " from the " Scroll Direction " as seen in the screenshot below. Then it will scroll horizontally depending on the numberOfItems you have returned in its datasource implementation.

Is CollectionView scrollable?

CollectionView defines a Scrolled event which is fired to indicate that scrolling occurred.

What is UICollectionView flow layout?

Overview. A flow layout is a type of collection view layout. Items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row containing as many cells as will fit. Cells can be the same sizes or different sizes.

What is compositional layout?

A compositional layout is composed of one or more sections that break up the layout into distinct visual groupings. Each section is composed of groups of individual items, the smallest unit of data you want to present. A group might lay out its items in a horizontal row, a vertical column, or a custom arrangement.


At the moment I'm trying to create an UICollectionView, that should display a simple excel-like-spreadsheet, with rows and columns. This should be an easy task with UICollectionViews, I believed. And I really would like to do the implementation in UICollectionView, not in any grid framework.

But at the moment I'm hanging a little bit. What I've figured out is, that I unfortunately can't use a UICollectionViewDelegateFlowLayout, because this only supports scrolling in either horizontally or vertically direction. But I need scrolling in both directions.

Therefore I have to use a UICollectionViewLayout, but for this I didn't find good examples, how to use it. Has anyone of you an example, how to subclass an UICollectionViewLayout to support rows and columns?

Thanks in advance.