Created
April 25, 2012 10:47
-
-
Save taylanpince/2488911 to your computer and use it in GitHub Desktop.
Pull to Refresh
This file contains 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
#pragma mark - Scroll View Delegate | |
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
[super scrollViewDidScroll:scrollView]; | |
if (_refreshInProgress) return; | |
if (self.tableView.contentOffset.y > 50.0 && self.tableView.contentOffset.y < 140.0) { | |
if (self.tableView.contentOffset.y <= 90.0) { | |
[(RefreshView *)self.tableView.tableHeaderView displayInstructions]; | |
} else { | |
[(RefreshView *)self.tableView.tableHeaderView hideInstructions]; | |
} | |
} | |
} | |
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { | |
[super scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; | |
if (self.tableView.contentOffset.y < 90.0) { | |
_refreshInProgress = YES; | |
[self.tableView setContentInset:UIEdgeInsetsMake(-100.0, 0.0, 0.0, 0.0)]; | |
[(RefreshView *)self.tableView.tableHeaderView startLoading]; | |
[self reloadData]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment