Skip to content

Commit

Permalink
Fix infinite scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
KyoheiG3 committed Apr 4, 2017
1 parent 5f79220 commit e234a18
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions GridView/GridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e234a18

Please sign in to comment.