MACRefreshHeader.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // MACRefreshHeader.m
  3. // WeiSchoolTeacher
  4. //
  5. // Created by MacKun on 16/1/11.
  6. // Copyright © 2016年 MacKun. All rights reserved.
  7. //
  8. #import "MACRefreshHeader.h"
  9. @implementation MACRefreshHeader
  10. -(void)prepare{
  11. [super prepare];
  12. // 设置普通状态的动画图片
  13. NSMutableArray *idleImages = [NSMutableArray array];
  14. for (NSUInteger i = 1; i<=60; i++) {
  15. UIImage *image = [UIImage imageNamed:@"icon_refresh_1"];
  16. [idleImages addObject:image];
  17. }
  18. [self setImages:idleImages forState:MJRefreshStateIdle];
  19. // 设置即将刷新状态的动画图片(一松开就会刷新的状态)
  20. NSMutableArray *refreshingImages = [NSMutableArray array];
  21. for (NSUInteger i = 1; i<=3; i++) {
  22. UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_refresh_%zd", i]];
  23. [refreshingImages addObject:image];
  24. }
  25. [self setImages:refreshingImages forState:MJRefreshStatePulling];
  26. // 设置正在刷新状态的动画图片
  27. [self setImages:refreshingImages forState:MJRefreshStateRefreshing];
  28. }
  29. @end