-1

The UICollectionViewFlowLayout object always come with a UICollectionView

When placing a UICollectionViewController or a UICollectionView inside my Storyboard I can see that a UICollectionViewFlowLayout object always comes with them.

I have no use for it. How do I delete it?

However, I have no use for it because I'm dealing with the UICollectionViewLayout, which is slightly different and customizable. I can't seem to find a way to delete it. It is also causing issues in my app.

Is there any way to delete the UICollectionViewFlowLayout object?

Community
  • 1
  • 1
Cesare
  • 9,139
  • 16
  • 78
  • 130

1 Answers1

1

You can't delete a UICollectionViewFlowLayout because every collection view needs one. It's just a matter of if it's a custom layout or a default one, but either way, it's still using a layout.

From the UICollectionView reference:

A very important object associated with a collection view is the layout object, which is a subclass of the UICollectionViewLayout class. The layout object is responsible for defining the organization and location of all cells and supplementary views inside the collection view.

Frankie
  • 11,508
  • 5
  • 53
  • 60
  • So should I subclass the `UICollectionViewFlowLayout` and assign that empty class to the object in the Storyboard? Thanks! – Cesare May 06 '15 at 19:10
  • It's not necessary to subclass `UICollectionViewFlowLayout` unless you want to. You can see that the object in the storyboard is already assigned. Click on the collection view object in the story board and look at the attributes inspector, you'll see it says 'layout' with 'flow' selected. – Frankie May 06 '15 at 19:13
  • Thank you! Do you think it is possible to combine `UICollectionViewFlowLayout` and `UICollectionViewLayout`. While the first one does not allow scrolling in both horizontal and vertical directions, it's got many features that can come in handy. Thanks again! – Cesare May 06 '15 at 19:31
  • Check your other question, I'll try to help you out. – Frankie May 06 '15 at 19:35