UICollectionView recieved layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0x975d290> {length = 2, path = 0 - 30}
几种情况 一般出现在 增加, 删除 ,减少item 刷新后崩溃
1. _CollectionView reloadData 换成 _CollectionView reloadSections
2.prepareLayout 里indexPath 是否正确 还有layoutAttributesForItemAtIndexPath 这个方法里的index path是否正确
3.检查- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect
这个方法里如果是返回全部的话 里面的数组个数是否正确
如果对您有帮助请给一个回复谢谢。
转载请注明原文地址: https://www.6miu.com/read-4113.html