瀏覽代碼

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

张爱民 6 年之前
父節點
當前提交
44b8c53412
共有 3 個文件被更改,包括 8 次插入0 次删除
  1. 3 0
      MJRefresh/Base/MJRefreshBackFooter.m
  2. 2 0
      MJRefresh/Base/MJRefreshComponent.h
  3. 3 0
      MJRefresh/Base/MJRefreshHeader.m

+ 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) {