Uicollectionview controller issue

2019-08-29 13:43发布

问题:

App crash and give following error message Terminating app due to uncaught exception

'NSInternalInconsistencyException', 
reason: '-[UICollectionViewController loadView]
 loaded the "RecipeCollectionViewController" nib but didn't get a UICollectionView.

回答1:

Try setting a breakpoint on:

[self.collectionView registerClass:[ImageCell class] forCellWithReuseIdentifier:@"MyCell"];

i would guess your loadView (did you mean viewDidLoad?) method is not being called, so the class is never registered with the collectionView.