Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of https://github.com/gmoledina/GMGridView

  • Loading branch information...
commit e3cc047343be1af9b15c909e42e4884fe24f0cf2 2 parents aff0fac + 9ae7d4d
Gulam Moledina gmoledina authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 GMGridView/GMGridView.m
8 GMGridView/GMGridView.m
View
@@ -1341,7 +1341,13 @@ - (void)loadRequiredItems
{
NSRange rangeOfPositions = [self.layoutStrategy rangeOfPositionsInBoundsFromOffset: self.contentOffset];
NSRange loadedPositionsRange = NSMakeRange(self.firstPositionLoaded, self.lastPositionLoaded - self.firstPositionLoaded);
-
+
+ if ((self.firstPositionLoaded != GMGV_INVALID_POSITION) &&
+ (self.lastPositionLoaded != GMGV_INVALID_POSITION) &&
+ NSEqualRanges(rangeOfPositions, loadedPositionsRange) ) {
+ return; // No need to load anything...
+ }
+
// calculate new position range
self.firstPositionLoaded = self.firstPositionLoaded == GMGV_INVALID_POSITION ? rangeOfPositions.location : MIN(self.firstPositionLoaded, (NSInteger)rangeOfPositions.location);
self.lastPositionLoaded = self.lastPositionLoaded == GMGV_INVALID_POSITION ? NSMaxRange(rangeOfPositions) : MAX(self.lastPositionLoaded, (NSInteger)(rangeOfPositions.length + rangeOfPositions.location));
Please sign in to comment.
Something went wrong with that request. Please try again.