mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fix PagerNode from not loading
This commit is contained in:
@@ -34,6 +34,9 @@
|
|||||||
|
|
||||||
- (CGPoint)_targetContentOffsetForItemAtIndexPath:(NSIndexPath *)indexPath proposedContentOffset:(CGPoint)proposedContentOffset
|
- (CGPoint)_targetContentOffsetForItemAtIndexPath:(NSIndexPath *)indexPath proposedContentOffset:(CGPoint)proposedContentOffset
|
||||||
{
|
{
|
||||||
|
if ([self _dataSourceIsEmpty]) {
|
||||||
|
return proposedContentOffset;
|
||||||
|
}
|
||||||
UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath];
|
UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath];
|
||||||
CGFloat xOffset = (self.collectionView.bounds.size.width - attributes.frame.size.width) / 2;
|
CGFloat xOffset = (self.collectionView.bounds.size.width - attributes.frame.size.width) / 2;
|
||||||
return CGPointMake(attributes.frame.origin.x - xOffset, proposedContentOffset.y);
|
return CGPointMake(attributes.frame.origin.x - xOffset, proposedContentOffset.y);
|
||||||
@@ -41,10 +44,6 @@
|
|||||||
|
|
||||||
- (NSIndexPath *)_indexPathForVisiblyCenteredItem
|
- (NSIndexPath *)_indexPathForVisiblyCenteredItem
|
||||||
{
|
{
|
||||||
if ([self _dataSourceIsEmpty]) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
CGRect visibleRect = [self _visibleRect];
|
CGRect visibleRect = [self _visibleRect];
|
||||||
CGFloat visibleXCenter = CGRectGetMidX(visibleRect);
|
CGFloat visibleXCenter = CGRectGetMidX(visibleRect);
|
||||||
NSArray<UICollectionViewLayoutAttributes *> *layoutAttributes = [self layoutAttributesForElementsInRect:visibleRect];
|
NSArray<UICollectionViewLayoutAttributes *> *layoutAttributes = [self layoutAttributesForElementsInRect:visibleRect];
|
||||||
|
|||||||
Reference in New Issue
Block a user