From e234a18ef34d3e2d5d6c9a79a693f0cccb430b61 Mon Sep 17 00:00:00 2001 From: ito_kyohei Date: Tue, 4 Apr 2017 15:50:02 -0700 Subject: [PATCH] Fix infinite scrolling --- GridView/GridView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GridView/GridView.swift b/GridView/GridView.swift index 0e2d70c..f1e648b 100644 --- a/GridView/GridView.swift +++ b/GridView/GridView.swift @@ -311,10 +311,11 @@ open class GridView: UIScrollView { } let matrix = currentMatrix + let offsetY = contentOffset.y - frame.minY if validityContentOffset.x < matrix.validityContentRect.minX { - return CGPoint(x: validityContentOffset.x + matrix.validityContentRect.width, y: contentOffset.y) + return CGPoint(x: validityContentOffset.x + matrix.validityContentRect.width, y: offsetY) } else if validityContentOffset.x >= matrix.validityContentRect.maxX { - return CGPoint(x: validityContentOffset.x - matrix.validityContentRect.width, y: contentOffset.y) + return CGPoint(x: validityContentOffset.x - matrix.validityContentRect.width, y: offsetY) } else { return nil }