Browse Source

Revert "Revert "Little change""

This reverts commit e3afdd24df0a2a4e342d01c19444409abf044ab3.
M了个J 7 years ago
parent
commit
07edef5ed2

+ 3 - 0
MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m

@@ -90,6 +90,9 @@ - (void)setState:(MJRefreshState)state
             [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{
                 self.loadingView.alpha = 0.0;
             } completion:^(BOOL finished) {
+                // 防止动画结束后,状态已经不是MJRefreshStateIdle
+                if (state != MJRefreshStateIdle) return;
+                
                 self.loadingView.alpha = 1.0;
                 [self.loadingView stopAnimating];
                 

+ 9 - 11
MJRefresh/UIScrollView+MJExtension.m

@@ -15,22 +15,20 @@
 
 @implementation UIScrollView (MJExtension)
 
-static BOOL mj_respondsToAdjustedContentInset;
+static BOOL respondsToAdjustedContentInset_;
 
-- (BOOL)gt_respondsToAdjustedContentInset {
-    
++ (void)initialize
+{
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        mj_respondsToAdjustedContentInset = [self respondsToSelector:@selector(adjustedContentInset)];
+        respondsToAdjustedContentInset_ = [self respondsToSelector:@selector(adjustedContentInset)];
     });
-    
-    return mj_respondsToAdjustedContentInset;
 }
 
 - (UIEdgeInsets)mj_inset
 {
 #ifdef __IPHONE_11_0
-    if ([self gt_respondsToAdjustedContentInset]) {
+    if (respondsToAdjustedContentInset_) {
         return self.adjustedContentInset;
     }
 #endif
@@ -42,7 +40,7 @@ - (void)setMj_insetT:(CGFloat)mj_insetT
     UIEdgeInsets inset = self.contentInset;
     inset.top = mj_insetT;
 #ifdef __IPHONE_11_0
-    if ([self gt_respondsToAdjustedContentInset]) {
+    if (respondsToAdjustedContentInset_) {
         inset.top -= (self.adjustedContentInset.top - self.contentInset.top);
     }
 #endif
@@ -59,7 +57,7 @@ - (void)setMj_insetB:(CGFloat)mj_insetB
     UIEdgeInsets inset = self.contentInset;
     inset.bottom = mj_insetB;
 #ifdef __IPHONE_11_0
-    if ([self gt_respondsToAdjustedContentInset]) {
+    if (respondsToAdjustedContentInset_) {
         inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom);
     }
 #endif
@@ -76,7 +74,7 @@ - (void)setMj_insetL:(CGFloat)mj_insetL
     UIEdgeInsets inset = self.contentInset;
     inset.left = mj_insetL;
 #ifdef __IPHONE_11_0
-    if ([self gt_respondsToAdjustedContentInset]) {
+    if (respondsToAdjustedContentInset_) {
         inset.left -= (self.adjustedContentInset.left - self.contentInset.left);
     }
 #endif
@@ -93,7 +91,7 @@ - (void)setMj_insetR:(CGFloat)mj_insetR
     UIEdgeInsets inset = self.contentInset;
     inset.right = mj_insetR;
 #ifdef __IPHONE_11_0
-    if ([self gt_respondsToAdjustedContentInset]) {
+    if (respondsToAdjustedContentInset_) {
         inset.right -= (self.adjustedContentInset.right - self.contentInset.right);
     }
 #endif