Skip to content
Browse files

Don't stay expanded if it doesn't start loading. Fixes #8

If the delegate returns no from `pullToRefreshViewShouldStartLoading:`, don't expand the view.
  • Loading branch information...
1 parent 3c68893 commit 42d4d63accb811899702e7f06103f24fa998acff @soffes soffes committed May 30, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 SSPullToRefreshView.m
View
4 SSPullToRefreshView.m
@@ -313,15 +313,17 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
SSPullToRefreshViewState newState = SSPullToRefreshViewStateLoading;
// Ask the delegate if it's cool to start loading
+ BOOL expand = YES;
if ([_delegate respondsToSelector:@selector(pullToRefreshViewShouldStartLoading:)]) {
if (![_delegate pullToRefreshViewShouldStartLoading:self]) {
// Animate back to normal since the delegate said no
newState = SSPullToRefreshViewStateNormal;
+ expand = NO;
}
}
// Animate to the new state
- [self _setState:newState animated:YES expanded:YES completion:nil];
+ [self _setState:newState animated:YES expanded:expand completion:nil];
}
@end

0 comments on commit 42d4d63

Please sign in to comment.
Something went wrong with that request. Please try again.