Skip to content

Commit 7964dac

Browse files
author
Giulio
authored
Merge pull request #31 from giulio92/feature/fix-wrong-targetContentOffset
Fix wrong targetContentOffset return values
2 parents a2f8155 + a1d9dfd commit 7964dac

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Classes/GLCollectionTableViewCell.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
3737
}
3838

3939
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
40+
guard proposedContentOffset.x > 0 else {
41+
return CGPoint(x: 0, y: 0)
42+
}
43+
4044
// If the UICollectionView has paginatedScroll set to false there is no
4145
// need to apply any pagination logic, we will return the current
4246
// proposedContentOffset coordinates.
@@ -112,7 +116,7 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
112116
offsetCorrection = cellLayoutAttribute.frame.origin.x - proposedXCoordWithInsets
113117
}
114118
}
115-
119+
116120
return CGPoint(x: proposedContentOffset.x + offsetCorrection, y: 0)
117121
}
118122
}

0 commit comments

Comments
 (0)