Skip to content

Commit

Permalink
Fix issue samvermette#90
Browse files Browse the repository at this point in the history
  • Loading branch information
yimingtang committed Dec 21, 2012
1 parent c14189e commit 6e98dcd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ @interface SVPullToRefreshView ()
@property (nonatomic, strong) NSMutableArray *viewForState;

@property (nonatomic, weak) UIScrollView *scrollView;
@property (nonatomic, readwrite) UIEdgeInsets originalScrollViewContentInset;
@property (nonatomic, readwrite) CGFloat originalTopInset;

@property (nonatomic, assign) BOOL wasTriggeredByUser;
Expand Down Expand Up @@ -276,6 +277,10 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset {
self.state = SVPullToRefreshStateTriggered;
else if(contentOffset.y >= scrollOffsetThreshold && self.state != SVPullToRefreshStateStopped)
self.state = SVPullToRefreshStateStopped;
} else {
CGFloat offset = MAX(self.scrollView.contentOffset.y * -1, 0);
offset = MIN(offset, self.originalScrollViewContentInset.top + 60.0f);
self.scrollView.contentInset = UIEdgeInsetsMake(offset, 0.0f, 0.0f, 0.0f);
}
}

Expand Down Expand Up @@ -421,6 +426,7 @@ - (void)setDateFormatter:(NSDateFormatter *)newDateFormatter {

- (void)triggerRefresh {
[self.scrollView triggerPullToRefresh];
[self.scrollView setContentOffset:CGPointMake(0, -60.0f) animated:YES];
}

- (void)startAnimating{
Expand Down

0 comments on commit 6e98dcd

Please sign in to comment.