Ios6 清空UICollectionView中的所有单元格
使用iOS6最新推出的Ios6 清空UICollectionView中的所有单元格,ios6,uicollectionview,Ios6,Uicollectionview,使用iOS6最新推出的UICollectionView如何删除大循环中的所有UICollectionViewCell对象 假设我已经将所有数据加载到其中,我点击“刷新”,我想删除其中当前的所有内容,然后再次调用我的资料 我发现了deleteimsatindexpaths,它需要一个NSArray,那么我如何才能将所有项目放入其中 结果表明,我可以使用deleteSections并将NSIndexSet传递给它,使范围为0,0,它将删除唯一的部分 NSIndexSet *indexSet = [N
UICollectionView
如何删除大循环中的所有UICollectionViewCell
对象
假设我已经将所有数据加载到其中,我点击“刷新”,我想删除其中当前的所有内容,然后再次调用我的资料
我发现了
deleteimsatindexpaths
,它需要一个NSArray
,那么我如何才能将所有项目放入其中 结果表明,我可以使用deleteSections
并将NSIndexSet
传递给它,使范围为0,0
,它将删除唯一的部分
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 0)];
[self.collectionView deleteSections:indexSet];
我可能只是在索引中使用
索引
,但当我的应用程序崩溃时。结果证明我可以使用删除节
,并将NSIndexSet
传递给它,使范围为0,0
,它将删除唯一的节
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 0)];
[self.collectionView deleteSections:indexSet];
我可能只是在索引中使用
索引
,但当我这样做时,我的应用程序崩溃了。清除UICollectionVew的正确方法是简单地清除数据源,然后重新加载集合视图
因此,如果数据源是数组:
self.dataArray = nil;
[self.collectionView reloadData];
Boom,你被清除了。清除UICollectionVew的正确方法是简单地清除数据源,然后重新加载collection视图 因此,如果数据源是数组:
self.dataArray = nil;
[self.collectionView reloadData];
砰的一声,你被清除了。为什么索引在索引中:0崩溃?我遇到了这种情况,不知道为什么Index:0崩溃?我遇到这种情况,不知道为什么,砰,砰,砰,砰,砰,砰。