Skip to content

Commit

Permalink
Fix auto footer continuous refreshing bug
Browse files Browse the repository at this point in the history
Fix auto footer continuous refreshing bug
  • Loading branch information
CoderMJLee committed Aug 10, 2015
1 parent ca19b16 commit a455a17
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion MJRefresh.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MJRefresh"
s.version = "2.4.2"
s.version = "2.4.3"
s.summary = "The easiest way to use pull-to-refresh"
s.homepage = "https://github.com/CoderMJLee/MJRefresh"
s.license = "MIT"
Expand Down
3 changes: 0 additions & 3 deletions MJRefresh/Base/MJRefreshAutoFooter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@

/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
@property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh;

/** 防止加载数据速度过快时,连续刷新N次 */
@property (assign, nonatomic, getter=isPreventContinuousRefreshing) BOOL preventContinuousRefreshing;
@end
12 changes: 3 additions & 9 deletions MJRefresh/Base/MJRefreshAutoFooter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "MJRefreshAutoFooter.h"

@interface MJRefreshAutoFooter()
@property (strong, nonatomic) UIPanGestureRecognizer *pan;
@end

@implementation MJRefreshAutoFooter
Expand Down Expand Up @@ -65,13 +64,6 @@ - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change

// 当底部刷新控件完全出现时,才刷新
[self beginRefreshing];

// 如果正在减速,并且希望阻止连续刷新
if (self.scrollView.isDecelerating && self.preventContinuousRefreshing) {
CGPoint offset = self.scrollView.contentOffset;
offset.y = _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h + _scrollView.mj_insetB - self.mj_h;
[self.scrollView setContentOffset:offset animated:YES];
}
}
}
}
Expand Down Expand Up @@ -100,7 +92,9 @@ - (void)setState:(MJRefreshState)state
MJRefreshCheckState

if (state == MJRefreshStateRefreshing) {
[self executeRefreshingCallback];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self executeRefreshingCallback];
});
}
}

Expand Down
Binary file not shown.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ UIView+MJExtension.h UIView+MJExtension.m
/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
@property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh;
/** 防止加载数据速度过快时,连续刷新N次 */
@property (assign, nonatomic, getter=isPreventContinuousRefreshing) BOOL preventContinuousRefreshing;
@end
```

Expand Down

0 comments on commit a455a17

Please sign in to comment.