我试图滚动到指定索引路径在UICollectionView
:检查'UICollectionView`索引路径是否有效?
if ([self collectionView:self.collectionView numberOfItemsInSection:0] > self.activeIndexPath.row && self.activeIndexPath.row > 0)
[self.collectionView scrollToItemAtIndexPath:self.activeIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
但我不断收到崩溃,此错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath: 0x1ff80a30> {length = 2, path = 0 - 40}
我怎么能滚动前验证索引路径?我的收藏视图只有1个部分。
似乎第一次重新加载数据后,开始工作,我会接受,如果在接下来的几天崩溃不会再出现 – Cbas
@Cbas - 当然!高兴地帮助:) –
@Cbas - 您的问题是否已解决?请接受答案,如果它已经:) –