UICollectionView重载一些区段崩溃

问题描述:

我重装secion当请求数据是成功。该方法是:UICollectionView重载一些区段崩溃

[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]];

NSIndexPath *idx = [NSIndexPath indexPathForItem:0 inSection:1]; 
    [self.collectionView reloadItemsAtIndexPaths:@[idx]]; 

,这是控制台输出:

[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UICollectionView.m:4324 

这个问题偶尔会发生!

在此先感谢!

+0

你能发布崩溃日志吗? – jarryd

+0

把你的代码放在https://developer.apple.com/reference/uikit/uicollectionview/1618045-performbatchupdates –

看来你的数据可能会改变可变

请使用

[self.collectionView reloadData] 
+0

我的集合的每个部分都有不同的数据,最后一部分可以加载更多。但reloadData性能低于reloadSections – taitanxiami

+0

请检查一次,如果它可以解决您的问题 – techloverr

+0

是的,它可以解决我的问题。但我想为什么? – taitanxiami

我有同样的问题。当其他部分的项目数量发生改变时,会发生这种情况,但您只需重新加载其中一个更改部分。