mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Nil out currentIndexPath after usage to prevent ASPagerFlowLayout crashes
This commit is contained in:
@@ -25,8 +25,10 @@
|
||||
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset
|
||||
{
|
||||
if (self.currentIndexPath) {
|
||||
return [self _targetContentOffsetForItemAtIndexPath:self.currentIndexPath
|
||||
proposedContentOffset:proposedContentOffset];
|
||||
CGPoint contentOffset = [self _targetContentOffsetForItemAtIndexPath:self.currentIndexPath
|
||||
proposedContentOffset:proposedContentOffset];
|
||||
self.currentIndexPath = nil;
|
||||
return contentOffset;
|
||||
}
|
||||
|
||||
return [super targetContentOffsetForProposedContentOffset:proposedContentOffset];
|
||||
@@ -34,7 +36,7 @@
|
||||
|
||||
- (CGPoint)_targetContentOffsetForItemAtIndexPath:(NSIndexPath *)indexPath proposedContentOffset:(CGPoint)proposedContentOffset
|
||||
{
|
||||
UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:self.currentIndexPath];
|
||||
UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath];
|
||||
CGFloat xOffset = (self.collectionView.bounds.size.width - attributes.frame.size.width) / 2;
|
||||
return CGPointMake(attributes.frame.origin.x - xOffset, proposedContentOffset.y);
|
||||
}
|
||||
@@ -60,4 +62,4 @@
|
||||
return visibleRect;
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user