Created
June 6, 2013 08:14
-
-
Save thomasbrueggemann/5720061 to your computer and use it in GitHub Desktop.
A simple pull-to-refresh for UIScrollViews. Whenever the UIScrollView ist pulled into a minus offset range auf at least -80, a reload method is triggered. But only if the scroll offset was in a range >= 0 before. This avoids infinite loading loops.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)scrollViewDidScroll:(UIScrollView *)sender | |
{ | |
if (sender.contentOffset.y >= 0) | |
{ | |
self.inZero = YES; | |
} | |
// if the user pulled into abyss ... | |
if (sender.contentOffset.y <= -80 && inZero == YES) | |
{ | |
inZero = NO; | |
// ... load content new | |
[self reload]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment