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

带动画的刷新完成回调 (#698)

张爱民 6 лет назад
Родитель
Сommit
44b8c53412

+ 3 - 0
MJRefresh/Base/MJRefreshBackFooter.m

@@ -91,6 +91,9 @@ - (void)setState:(MJRefreshState)state
             [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{
                 self.scrollView.mj_insetB -= self.lastBottomDelta;
                 
+                if (self.endRefreshingAnimateCompletionBlock) {
+                    self.endRefreshingAnimateCompletionBlock();
+                }
                 // 自动调整透明度
                 if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0;
             } completion:^(BOOL finished) {

+ 2 - 0
MJRefresh/Base/MJRefreshComponent.h

@@ -62,6 +62,8 @@ typedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(void);
 - (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock;
 /** 开始刷新后的回调(进入刷新状态后的回调) */
 @property (copy, nonatomic) MJRefreshComponentbeginRefreshingCompletionBlock beginRefreshingCompletionBlock;
+/** 带动画的结束刷新的回调 */
+@property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingAnimateCompletionBlock;
 /** 结束刷新的回调 */
 @property (copy, nonatomic) MJRefreshComponentEndRefreshingCompletionBlock endRefreshingCompletionBlock;
 /** 结束刷新状态 */

+ 3 - 0
MJRefresh/Base/MJRefreshHeader.m

@@ -123,6 +123,9 @@ - (void)setState:(MJRefreshState)state
         [UIView animateWithDuration:MJRefreshSlowAnimationDuration animations:^{
             self.scrollView.mj_insetT += self.insetTDelta;
             
+            if (self.endRefreshingAnimateCompletionBlock) {
+                self.endRefreshingAnimateCompletionBlock();
+            }
             // 自动调整透明度
             if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0;
         } completion:^(BOOL finished) {