私は初めてUICollectionViewで、Webで見つけたチュートリアルに従っていますが、理解できないエラーで立ち往生しています。ここに少しコンテキストがあります。
デバッガーでは、次のことが起こっていることがわかります。
numberOfSectionsInCollectionView:が呼び出され、1を返しますcollectionView:numberOfItemsInSection:と呼ばれ、モデルのサイズを返します(20)collectionView:layout:sizeForItemAtIndexPath:モデル内のアイテムごとに1回呼び出されますcollectionView:layout:insetForSectionAtIndex:と呼ばれるcollectionView:cellForItemAtIndexPath:呼び出され、この行でクラッシュします...UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
このエラーで...
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
その行で実行を一時停止してコンソールを確認すると、レイアウトがあるように見えます...
(lldb) po collectionView.collectionViewLayout
(UICollectionViewLayout *) $4 = 0x07180fd0 <UICollectionViewFlowLayout: 0x7180fd0>
UICollectionViewは、ストーリーボードの唯一のシーンの一部です。viewController.mには、他にUICollectionView作成されたものはありません。
誰かアイデアはありますか?