iOS Collectionview报错

一直报错:

Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.33.6/UICollectionView.m:5279

2018-07-31 16:14:48.998991+0800 Treasure[27863:33202992] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier HomeOptionCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

xx,不相信了
使用registerClass,registerNib都正确,最终是继承关系的父类有问题,折腾1小时,不要怀疑自己。向上找问题
[self.m_CollectionView registerClass:[HomeOptionCell class] forCellWithReuseIdentifier:@"HomeOptionCell"];

[self.m_CollectionView registerNib:[UINib nibWithNibName:NSStringFromClass([HomeOptionCell class]) bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HomeOptionCell"];

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容