Been reading the docs (should possibly have done this first :) )
Anyway, the collectionView I am using is within a separate xib file (not a storyboard) and from the docs...
Important:You must register a classor nib file using the registerClass:forCellWithReuseIdentifier:or registerNib:forCellWithReuseIdentifier: method before calling this method.
Thanks
回答3:
Make sure that if you use the registerNib: method:
that ALSO in the nib file, when you select the top-level collection reusable view, use the attributes inspector, and make sure the Identifier is set to the same value you are passing in to the withReuseIdentifier: parameter.
I have seen this error pop up when using multiple UICollectionViews with unique ReuseIdentifiers. In ViewDidLoad you want to register each CollectionView's reuseIdentifier like so:
Then when you get to "- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath" you want to make sure that you don't try to set a cell for collectionView1 to the reuseIdentifier for collectionView2 or you will get this error.
DON'T DO THIS: (Or collectionView2 will see the wrong Identifier and throw a fit before seeing the identifier it was expecting)