为了账号安全,请及时绑定邮箱和手机立即绑定

如何实例化一个collectionview 的cell?

如何实例化一个collectionview 的cell?

临摹微笑 2019-04-16 17:05:48
letcell=collectionView.dequeueReusableCellWithReuseIdentifier("BigRoomVideoCell",forIndexPath:indexPath)asVideoViewCell上面是重用cell的写法,但是如何每次都实例化一个collectionview的cell?我尝试过letcell=VideoViewCell()直接报***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'thecellreturnedfrom-collectionView:cellForItemAtIndexPath:doesnothaveareuseIdentifier-cellsmustberetrievedbycalling-dequeueReusableCellWithReuseIdentifier:forIndexPath:google了也没找到合适的答案
查看完整描述

2 回答

?
弑天下

TA贡献1818条经验 获得超8个赞

也试过letcell=collectionView.cellForItemAtIndexPath(indexPath)asVideoViewCell办法,直接报fatalerror:unexpectedlyfoundnilwhileunwrappinganOptionalvalue
                            
查看完整回答
反对 回复 2019-04-16
?
largeQ

TA贡献2039条经验 获得超8个赞

是否没有注册
[_collectionViewregisterClass:[BigRoomVideoCellclass]
forCellWithReuseIdentifier:CELL_IDENTIFIER];
                            
查看完整回答
反对 回复 2019-04-16
  • 2 回答
  • 0 关注
  • 361 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号