0

I'm having a difficult time figuring out how to designing what feels like it should be a fairly straightforward layout for my collection view. The heights of each cell are equal. The widths vary. The inter-item spacing should always be equal. The distance between rows should also always be equal. As more items are added, the width of the collection view will increase "intelligently." Let me give an example.

Desired layout

When I insert a new item, I will calculate the movement of items from rows (maybe the first item of row 1 moves up to row 0, maybe the first item of row 2 moves up to row 1. I then move it and the collection view grows wider.

Colors added for illustrative purposes

I feel like this should be reasonably straightforward but I'm struggling. Does anyone have some sample code that could help?

Samuel Hicks
  • 113
  • 1
  • 4

1 Answers1

-1

Have you tried this using UICollectionViewFlowLayout?

http://skeuo.com/uicollectionview-custom-layout-tutorial

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewFlowLayout_class/

StevenOjo
  • 2,498
  • 1
  • 16
  • 21