Skip to content

Commit

Permalink
will not call setNeedsLayout if visible contents is far away from ref…
Browse files Browse the repository at this point in the history
…resh control #13
  • Loading branch information
ishkawa committed Jun 8, 2013
1 parent 0e37003 commit 86a7cbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ISRefreshControl/ISRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
CGFloat y = offset < -self.frame.size.height ? offset - topInset : -self.frame.size.height - topInset;
self.frame = CGRectOffset(self.frame, 0.f, y - self.frame.origin.y);

self.gumView.distance = offset < -self.frame.size.height ? -offset-self.frame.size.height : 0.f;
if (offset < 0.f) {
self.gumView.distance = offset < -self.frame.size.height ? -offset-self.frame.size.height : 0.f;
}

// hides gumView when it is about to appear by inertial scrolling.
if (scrollView.isTracking && !self.isRefreshing) {
Expand Down Expand Up @@ -268,6 +270,7 @@ - (void)subtractTopInsets
completion:^(BOOL finished) {
self.subtractingTopInset = NO;
self.addedTopInset = NO;
self.gumView.distance = 0.f;

if (scrollView.contentOffset.y <= scrollView.contentInset.top && !scrollView.isDragging) {
[self reset];
Expand Down

0 comments on commit 86a7cbc

Please sign in to comment.