
Terminating app due to uncaught exception ‘NSInternalinconsistencyException’,reason: ‘Could not dequeue a vIEw of kind: UICollectionElementKindCell with IDentifIEr Cell – must register a nib or a class for the IDentifIEr or connect a prototype cell in a storyboard’
我的VIEwDIDLoad中有以下内容:
[self.collectionVIEw registerClass:[UICollectionVIEwCell class] forCellWithReuseIDentifIEr:@"Cell"];
而崩溃的行在cellForItemAtIndexPath回调中:
UICollectionVIEwCell *cell = [collectionVIEw dequeueReusableCellWithReuseIDentifIEr:@"Cell" forIndexPath:indexPath];
我一直在搜索几个小时,但找不到任何解决方案.我试过子类化UICollectionVIEwCell但是得到相同的错误.
有断点我已经确定在执行dequeueReusableCellWithReuseIDentifIEr回调之前registerClass行被执行.
解决方法 我有这个问题,因为我正在调用registerClass之前,我正在实例化我的表视图对象.工作代码:self.tableVIEw = [[UItableVIEw alloc] initWithFrame:self.vIEw.frame];[self.tableVIEw registerClass:[UItableVIEwCell class] forCellReuseIDentifIEr:@"Cell"];[self.vIEw addSubvIEw:self.tableVIEw];self.tableVIEw.delegate = self;self.tableVIEw.dataSource = self;[self.tableVIEw reloadData];总结
以上是内存溢出为你收集整理的xcode – dequeueReusableCellWithReuseIdentifier crash’不能出现种类的视图“UICollectionElementKindCell”全部内容,希望文章能够帮你解决xcode – dequeueReusableCellWithReuseIdentifier crash’不能出现种类的视图“UICollectionElementKindCell”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)