- An easy way to use pull-to-refresh
- Getting Started
- Comment API
- Examples
- Hope
Support what kinds of controls to refresh
UIScrollView
、UITableView
、UICollectionView
、UIWebView
- Installation with CocoaPods:
pod 'MJRefresh'
- Installation with Carthage:
github "CoderMJLee/MJRefresh"
- Manual import:
- Drag All files in the
MJRefresh
folder to project
- Import the main file:
#import "MJRefresh.h"
Base Custom
MJRefresh.bundle MJRefresh.h
MJRefreshConst.h MJRefreshConst.m
UIScrollView+MJExtension.h UIScrollView+MJExtension.m
UIScrollView+MJRefresh.h UIScrollView+MJRefresh.m
UIView+MJExtension.h UIView+MJExtension.m
More than hundreds of Apps are using MJRefresh
- More information of App can focus on:M了个J-博客园
The Class Structure Chart of MJRefresh
The class of red text
in the chart:You can use them directly
- The drop-down refresh control types
- Normal:
MJRefreshNormalHeader
- Gif:
MJRefreshGifHeader
- The pull to refresh control types
- Auto refresh
- Normal:
MJRefreshAutoNormalFooter
- Gif:
MJRefreshAutoGifFooter
- Auto Back
- Normal:
MJRefreshBackNormalFooter
- Gif:
MJRefreshBackGifFooter
The class of non-red text
in the chart:For inheritance,to use DIY the control of refresh
- About how to DIY the control of refresh,You can refer the Class in below Chart
@interface MJRefreshComponent : UIView
#pragma mark - Control the state of Refresh
- (void)beginRefreshing;
- (void)endRefreshing;
- (BOOL)isRefreshing;
#pragma mark - Other
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
@end
@interface MJRefreshHeader : MJRefreshComponent
+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
@property (copy, nonatomic) NSString *lastUpdatedTimeKey;
@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;
@end
@interface MJRefreshFooter : MJRefreshComponent
+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
- (void)noticeNoMoreData;
- (void)resetNoMoreData;
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;
@end
@interface MJRefreshAutoFooter : MJRefreshFooter
@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;
@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;
@end
* Due to there are more functions of this framework,Don't write specific text describe its usage
* You can directly reference examples MJTableViewController、MJCollectionViewController、MJWebViewController,More intuitive and fast.
The drop-down refresh 01-Default
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
}];
或
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
[self.tableView.mj_header beginRefreshing];
The drop-down refresh 02-Animation image
MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
[header setImages:idleImages forState:MJRefreshStateIdle];
[header setImages:pullingImages forState:MJRefreshStatePulling];
[header setImages:refreshingImages forState:MJRefreshStateRefreshing];
self.tableView.mj_header = header;
The drop-down refresh 03-Hide the time
header.lastUpdatedTimeLabel.hidden = YES;
The drop-down refresh 04-Hide status and time
header.lastUpdatedTimeLabel.hidden = YES;
header.stateLabel.hidden = YES;
The drop-down refresh 05-DIY title
[header setTitle:@"Pull down to refresh" forState:MJRefreshStateIdle];
[header setTitle:@"Release to refresh" forState:MJRefreshStatePulling];
[header setTitle:@"Loading ..." forState:MJRefreshStateRefreshing];
header.stateLabel.font = [UIFont systemFontOfSize:15];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];
header.stateLabel.textColor = [UIColor redColor];
header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];
The drop-down refresh 06-DIY the control of refresh
self.tableView.mj_header = [MJDIYHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
The pull to refresh 01-Default
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
}];
或
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
The pull to refresh 02-Animation image
MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
self.tableView.mj_footer = footer;
The pull to refresh 03-Hide the title of refresh status
footer.refreshingTitleHidden = YES;
The pull to refresh 04-All loaded
[footer noticeNoMoreData];
The pull to refresh 05-DIY title
[footer setTitle:@"Click or drag up to refresh" forState:MJRefreshStateIdle];
[footer setTitle:@"Loading more ..." forState:MJRefreshStateRefreshing];
[footer setTitle:@"No more data" forState:MJRefreshStateNoMoreData];
footer.stateLabel.font = [UIFont systemFontOfSize:17];
footer.stateLabel.textColor = [UIColor blueColor];
The pull to refresh 06-Hidden After loaded
self.tableView.mj_footer.hidden = YES;
The pull to refresh 07-Automatic back of the pull01
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
The pull to refresh 08-Automatic back of the pull02
MJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
[footer setImages:idleImages forState:MJRefreshStateIdle];
[footer setImages:pullingImages forState:MJRefreshStatePulling];
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
self.tableView.mj_footer = footer;
The pull to refresh 09-DIY the control of refresh(Automatic refresh)
self.tableView.mj_footer = [MJDIYAutoFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
The pull to refresh 10-DIY the control of refresh(Automatic back)
self.tableView.mj_footer = [MJDIYBackFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
UICollectionView01-The pull and drop-down refresh
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
}];
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
}];
UIWebView01-The drop-down refresh
self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
}];
- ARC
- iOS>=6.0
- iPhone \ iPad screen anyway
- If you find bug when used,Hope you can Issues me,Thank you or try to download the latest code of this framework to see the BUG has been fixed or not)
- If you find the function is not enough when used,Hope you can Issues me,I very much to add more useful function to this framework ,Thank you !
- If you want to contribute code for MJRefresh,please Pull Requests me
- If you use MJRefresh in your develop app,Hope you can go toCocoaControlsto add the iTunes path
of you app,I Will install your app,and according to the usage of many app,to be a better design and improve to MJRefresh,Thank you !
- StepO1(WeChat is just an Example,Explore“Your app name itunes”)
- StepO2
- StepO3
- StepO4
- 因本人工作忙,没有太多时间去维护MJRefresh,在此向广大框架使用者说声:非常抱歉!😞
- 现寻求志同道合的小伙伴一起维护此框架,有兴趣的小伙伴可以发邮件给我,非常感谢😊
- 如果一切OK,我将开放框架维护权限(github、pod等)
- 目前已经找到3位小伙伴(^-^)V