Permalink
Browse files

Added animation delegate to re-check if data is finished loading. Thi…

…s fixes a bug which causes the loading view to display indefinately if the data is loaded before the pull-down animation is complete.
  • Loading branch information...
henryeverett committed Sep 21, 2011
1 parent 743679f commit 4933a28700c73adcef87dae0056d3b6fffb7100d
@@ -119,14 +119,21 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL
}
+-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
+ if (!_reloading) {
+ [_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];
+ }
+}
+
#pragma mark -
#pragma mark EGORefreshTableHeaderDelegate Methods
- (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view{
[self reloadTableViewDataSource];
- [self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];
+ [self doneLoadingTableViewData];
+ //[self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];
}
@@ -225,6 +225,8 @@ - (void)egoRefreshScrollViewDidEndDragging:(UIScrollView *)scrollView {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);
+ [UIView setAnimationDelegate:_delegate];
+ [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
[UIView commitAnimations];
}
@@ -228,6 +228,8 @@ - (void)egoRefreshScrollViewDidEndDragging:(UIScrollView *)scrollView {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);
+ [UIView setAnimationDelegate:_delegate];
+ [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
[UIView commitAnimations];
}

0 comments on commit 4933a28

Please sign in to comment.