Fix PagerNode from not loading

This commit is contained in:
Levi McCallum
2016-03-25 10:02:47 -07:00
parent c1330682f9
commit 687be58621

View File

@@ -34,6 +34,9 @@
- (CGPoint)_targetContentOffsetForItemAtIndexPath:(NSIndexPath *)indexPath proposedContentOffset:(CGPoint)proposedContentOffset
{
if ([self _dataSourceIsEmpty]) {
return proposedContentOffset;
}
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);
@@ -41,10 +44,6 @@
- (NSIndexPath *)_indexPathForVisiblyCenteredItem
{
if ([self _dataSourceIsEmpty]) {
return nil;
}
CGRect visibleRect = [self _visibleRect];
CGFloat visibleXCenter = CGRectGetMidX(visibleRect);
NSArray<UICollectionViewLayoutAttributes *> *layoutAttributes = [self layoutAttributesForElementsInRect:visibleRect];