iOS Collectionview報(bào)錯(cuò)

一直報(bào)錯(cuò):

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都正確,最終是繼承關(guān)系的父類有問(wèn)題,折騰1小時(shí),不要懷疑自己。向上找問(wèn)題
[self.m_CollectionView registerClass:[HomeOptionCell class] forCellWithReuseIdentifier:@"HomeOptionCell"];

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • iOS流布局UICollectionView系列一——初識(shí)與簡(jiǎn)單使用UICollectionView 一、簡(jiǎn)介 U...
    我是啊梁閱讀 10,681評(píng)論 3 10
  • 1.ios高性能編程 (1).內(nèi)層 最小的內(nèi)層平均值和峰值(2).耗電量 高效的算法和數(shù)據(jù)結(jié)構(gòu)(3).初始化時(shí)...
    歐辰_OSR閱讀 30,282評(píng)論 8 265
  • 一、UICollectionView介紹 UICollectionView和UICollectionViewCon...
    無(wú)灃閱讀 4,777評(píng)論 4 18
  • Swift1> Swift和OC的區(qū)別1.1> Swift沒(méi)有地址/指針的概念1.2> 泛型1.3> 類型嚴(yán)謹(jǐn) 對(duì)...
    cosWriter閱讀 11,684評(píng)論 1 32
  • 我獨(dú)步走在這條街上,它雖是鄉(xiāng)路,但今天,這里也算是車水馬龍。陰歷八月十五,中秋節(jié)在望之日。在望,街上的人都在望著...
    Yi__yi閱讀 671評(píng)論 0 2

友情鏈接更多精彩內(nèi)容