如何实例化一个collectionview 的cell?

letcell=collectionView.dequeueReusableCellWithReuseIdentifier("BigRoomVideoCell",forIndexPath:indexPath)asVideoViewCell
上面是重用cell的写法,但是如何每次都实例化一个collectionview的cell?
我尝试过letcell=VideoViewCell()
直接报
***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'thecellreturnedfrom-collectionView:cellForItemAtIndexPath:doesnothaveareuseIdentifier-cellsmustberetrievedbycalling-dequeueReusableCellWithReuseIdentifier:forIndexPath:
google了也没找到合适的答案
慕标5832272
浏览 466回答 2
2回答

慕村225694

也试过letcell=collectionView.cellForItemAtIndexPath(indexPath)asVideoViewCell办法,直接报fatalerror:unexpectedlyfoundnilwhileunwrappinganOptionalvalue

POPMUISE

是否没有注册[_collectionViewregisterClass:[BigRoomVideoCellclass]forCellWithReuseIdentifier:CELL_IDENTIFIER];
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript