iOS 刷新框架(MJRefresh)

文章目录
  一、类结构图
  MJRefreshComponent.h
  MJRefreshHeader.h
  MJRefreshFooter.h
  MJRefreshAutoFooter.h

类的结构图
MJRefresh结构图.png
[https://github.com/CoderMJLee/MJRefresh](https://github.com/CoderMJLee/MJRefresh)

  类的具体声明

MJRefreshComponent.h
/** 刷新控件的基类 */
@interface MJRefreshComponent : UIView
#pragma mark - 刷新状态控制
/** 进入刷新状态 */
- (void)beginRefreshing;
/** 结束刷新状态 */
- (void)endRefreshing;
/** 是否正在刷新 */
- (BOOL)isRefreshing;
#pragma mark - 其它
/** 根据拖拽比例自动切换透明度 */
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
@end
MJRefreshHeader.h

@interface MJRefreshHeader : MJRefreshComponent
/** 创建 header */
+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
/** 创建 header */
+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
/** 这个 key 用来存储上一次下拉刷新成功的时间 */
@property (copy, nonatomic) NSString *lastUpdatedTimeKey;
/** 上一次下拉刷新成功的时间 */
@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;
/** 忽略多少 scrollView 的 contentInset 的顶部 */
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;
@end
MJRefreshFooter.h

@interface MJRefreshFooter : MJRefreshComponent
/** 创建 footer */
+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
/** 创建 footer */
+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
 
/** 提示没有更多的数据 */
- (void)noticeNoMoreData;
/** 重置没有更多的数据(消除没有更多数据的状态) */
- (void)resetNoMoreData;
 
/** 忽略多少 scrollView 的 contentInset 的底部*/
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;
 
/** 自动根据有无数据来显示和隐藏 */
@property (assign, nonatomic) BOOL automaticallyHidden;
@end
MJRefreshAutoFooter.h

@interface MJRefreshAutoFooter : MJRefreshFooter
/** 是否自动刷新(默认为 YES) */
@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;
 
/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
@property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh;
@end
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • MJRefresh的使用 - (void)viewWillAppear:(BOOL)animated{[super...
    Bryan5137阅读 975评论 0 0
  • MJRefresh是李明杰老师的作品,到现在已经有9800多颗star了,是一个简单实用,功能强大的iOS下拉刷新...
    Style_mao阅读 683评论 1 2
  • 朝阳照吉宅熠熠生辉 晚霞映庭院盈盈瑞气 一宅迎旭日蒸蒸日上 家接百福步步登高 望南山松柏葱荣茂密 看比邻楼房鳞次栉...
    幽松明月阅读 254评论 0 0
  • 今天是儿子开学后的第一个星期天,我像往常一样早早的起床把早餐准备好,然后叫儿子起床吃饭,儿子醒来的第一句话就问我:...
    家浩麻麻阅读 248评论 0 2
  • 早检坐班 早检签到 早上七点半前到办公室,打开常检登记表。根据微信签到,挨个在常检登记表上划勾签到。差不多7点40...
    Micyoco阅读 328评论 1 0