UICollectionView中的iOS断言失败 [英] iOS Assertion Failure in UICollectionView
本文介绍了UICollectionView中的iOS断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到错误...
*** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:], /SourceCache/UIKit/UIKit-2372/UICollectionView.m:2249
尝试显示时一个UICollectionView。
When trying to display a UICollectionView.
引起它的行是......
The lines causing it are...
static NSString *CellIdentifier = @"Cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
出列时发生错误。
没有其他错误,所以我很难知道从哪里开始。
There are no other errors so I'm struggling to know where to begin with this.
有人可以解释这个吗?
推荐答案
一直在阅读文档(应该先做这个:) :)
Been reading the docs (should possibly have done this first :) )
无论如何,collectionView我是使用是在一个单独的xib文件(不是故事板)和文档...
Anyway, the collectionView I am using is within a separate xib file (not a storyboard) and from the docs...
Important: You must register a class or nib file using the
registerClass:forCellWithReuseIdentifier: or
registerNib:forCellWithReuseIdentifier: method before calling this method.
谢谢
这篇关于UICollectionView中的iOS断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文