Просмотр исходного кода

去除了刷新完毕后箭头突然出现的效果

MJ Lee 11 лет назад
Родитель
Сommit
53faa8590b

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


+ 1 - 1
MJRefreshExample/MJRefreshExample.xcodeproj/xcuserdata/mj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -6,7 +6,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             scope = "0"

+ 21 - 5
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshBaseView.m

@@ -212,11 +212,27 @@ - (void)setState:(MJRefreshState)state
     switch (state) {
 		case MJRefreshStateNormal: // 普通状态
         {
-            // 显示箭头
-            self.arrowImage.hidden = NO;
-            
-            // 停止转圈圈
-            [self.activityView stopAnimating];
+            if (self.state == MJRefreshStateRefreshing) {
+                [UIView animateWithDuration:MJRefreshSlowAnimationDuration * 0.4 animations:^{
+                    self.activityView.alpha = 0.0;
+                } completion:^(BOOL finished) {
+                    // 停止转圈圈
+                    [self.activityView stopAnimating];
+                    
+                    // alpha
+                    self.activityView.alpha = 1.0;
+                }];
+                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(MJRefreshSlowAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                    // 显示箭头
+                    self.arrowImage.hidden = NO;
+                });
+            } else {
+                // 显示箭头
+                self.arrowImage.hidden = NO;
+                
+                // 停止转圈圈
+                [self.activityView stopAnimating];
+            }
 			break;
         }