Search code examples
iosswiftuicollectionviewuicollectionviewcell

Create non-reusable cells UICollectionView


I've seen tutorials where they create cells that follow a specific pattern (each have a label that displays text from an array etc.) but I want to create cells that are different from each other. I was thinking of adding them like how you'd add an image with code (create constant, set position and then view.addSubView(image)) but that isn't working.

I'm using swift 3


Solution

  • You could use an unique reuse identifier for every cell. That would technically disable the reuse mechanism. So if the cells content is unique but the size the same this should work, although I think it is a better way to reuse the cells and reset the content area. If the cell size is different you must find a suitable layout at first.