Browse Source

Fix auto footer continuous refreshing bug

Fix auto footer continuous refreshing bug
MJLee 10 years ago
parent
commit
a455a178d1

+ 1 - 1
MJRefresh.podspec

@@ -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"

+ 0 - 3
MJRefresh/Base/MJRefreshAutoFooter.h

@@ -14,7 +14,4 @@
 
 /** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
 @property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh;
-
-/** 防止加载数据速度过快时,连续刷新N次 */
-@property (assign, nonatomic, getter=isPreventContinuousRefreshing) BOOL preventContinuousRefreshing;
 @end

+ 3 - 9
MJRefresh/Base/MJRefreshAutoFooter.m

@@ -9,7 +9,6 @@
 #import "MJRefreshAutoFooter.h"
 
 @interface MJRefreshAutoFooter()
-@property (strong, nonatomic) UIPanGestureRecognizer *pan;
 @end
 
 @implementation MJRefreshAutoFooter
@@ -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];
-            }
         }
     }
 }
@@ -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];
+        });
     }
 }
 

BIN
MJRefreshExample/MJRefreshExample.xcodeproj/project.xcworkspace/xcuserdata/mj.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 3
README.md

@@ -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
 ```