Single row display in UICollectionView - Swift

I am trying to figure out how to restrict the UICollectionView to display a horizontal scrollable list on one line.

Any ideas?

+4
source share
1 answer

I just used something that works for me:

  • Set the scroll direction to horizontal.
  • Set your size Cellusing the method sizeForItemAt indexPath.
  • Set a limit on CollectionViewso that its height is equal to (or slightly larger) than the height Cellspecified above.

Logics:

CollectionView item, , row. " , Cell height", , CollectionView , Cell height, 2 Cell, 2 .

+1

All Articles