Explorar el Código

Fix double footer beginRefreshing

Fix double footer beginRefreshing
MJLee hace 10 años
padre
commit
5a742d5543
Se han modificado 2 ficheros con 6 adiciones y 1 borrados
  1. 1 1
      MJRefresh.podspec
  2. 5 0
      MJRefresh/Base/MJRefreshAutoFooter.m

+ 1 - 1
MJRefresh.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name         = "MJRefresh"
-  s.version      = "2.0.2"
+  s.version      = "2.0.3"
   s.summary      = "The easiest way to use pull-to-refresh"
   s.homepage     = "https://github.com/CoderMJLee/MJRefresh"
   s.license      = "MIT"

+ 5 - 0
MJRefresh/Base/MJRefreshAutoFooter.m

@@ -58,6 +58,11 @@ - (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
     if (_scrollView.mj_insetT + _scrollView.mj_contentH > _scrollView.mj_h) { // 内容超过一个屏幕
         // 这里的_scrollView.mj_contentH替换掉self.mj_y更为合理
         if (_scrollView.mj_offsetY > _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h * self.appearencePercentTriggerAutoRefresh + _scrollView.mj_insetB - self.mj_h) {
+            // 防止手松开时连续调用
+            CGPoint old = [change[@"old"] CGPointValue];
+            CGPoint new = [change[@"new"] CGPointValue];
+            if (new.y <= old.y) return;
+            
             // 当底部刷新控件完全出现时,才刷新
             [self beginRefreshing];
         }