Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在UICollectionView中,为什么我们要使用ReuseIdentifier:forIndexPath:_Objective C_Ios6_Xcode4.5_Uicollectionview - Fatal编程技术网

Objective c 在UICollectionView中,为什么我们要使用ReuseIdentifier:forIndexPath:

Objective c 在UICollectionView中,为什么我们要使用ReuseIdentifier:forIndexPath:,objective-c,ios6,xcode4.5,uicollectionview,Objective C,Ios6,Xcode4.5,Uicollectionview,而不是正常的 dequeueReusableCellWithReuseIdentifier 此dequeueReusableCellWithReuseIdentifier:forIndexPath:要求我们注册内容。这很烦人 这个问题根本没有问我们为什么要费心去挖那个牢房。我知道为什么。这个问题问我们为什么不退出UICollectionView出于性能原因,当集合视图的数据源在其collectionView:cellForRowAtIndexPath:方法中将单元格分配给项目时,通常应该重用U

而不是正常的

dequeueReusableCellWithReuseIdentifier
dequeueReusableCellWithReuseIdentifier:forIndexPath:
要求我们注册内容。这很烦人


这个问题根本没有问我们为什么要费心去挖那个牢房。我知道为什么。这个问题问我们为什么不退出UICollectionView出于性能原因,当集合视图的数据源在其
collectionView:cellForRowAtIndexPath:
方法中将单元格分配给项目时,通常应该重用
UICollectionViewCell
对象。集合视图维护数据源标记为可重用的
UICollectionView
对象的队列或列表。

是,就像在UITableView中一样。但是,在UITableView中,我们使用dequeueReusableCellWithReuseIdentifier,而不是dequeueReusableCellWithReuseIdentifier:ForInExpath这是一种旧方法。出于性能方面的考虑,苹果公司建议对表视图使用dequeueReusableCellWithReuseIdentifier:forIndexPath:。不管怎样,对于UICollectionView你们并没有任何选择。苹果公司考虑的是什么?你们应该为cell注册类或nib。并在collectionView:cellForRowAtIndexPath:中使用dequeueReusableCellWithReuseIdentifier:ForIndexXPath。你看到其他解决方案了吗?不知道“注册物品”是什么意思。但这很烦人。使用
UITableView
,我发现从故事板中取出一个额外的单元格并将其用于高度计算非常方便。据我所知,这不能用
UICollectionView
完成,因为需要提供有效的
nsindepath