|
|
@@ -1,49 +1,48 @@
|
|
|

|
|
|
## MJRefresh
|
|
|
* An easy way to use pull-to-refresh
|
|
|
-* 用法简单的下拉刷新框架:一行代码搞定
|
|
|
|
|
|
## Contents
|
|
|
* Getting Started
|
|
|
- * [Features【支持哪些控件的刷新】](#支持哪些控件的刷新)
|
|
|
- * [Installation【如何使用MJRefresh】](#如何使用MJRefresh)
|
|
|
- * [Who's using【已经超过上百个App正在使用MJRefresh】](#已经超过上百个App正在使用MJRefresh)
|
|
|
- * [Classes【MJRefresh类结构图】](#MJRefresh类结构图)
|
|
|
-* 常见API
|
|
|
+ * [Features【Support what kinds of controls to refresh】](#Support what kinds of controls to refresh)
|
|
|
+ * [Installation【How to use MJRefresh】](#How to use MJRefresh)
|
|
|
+ * [Who's using【More than hundreds of Apps are using MJRefresh】](#>More than hundreds of Apps are using MJRefresh)
|
|
|
+ * [Classes【The Class Structure Chart of MJRefresh】](#The Class Structure Chart of MJRefresh)
|
|
|
+* Comment API
|
|
|
* [MJRefreshComponent.h](#MJRefreshComponent.h)
|
|
|
* [MJRefreshHeader.h](#MJRefreshHeader.h)
|
|
|
* [MJRefreshFooter.h](#MJRefreshFooter.h)
|
|
|
* [MJRefreshAutoFooter.h](#MJRefreshAutoFooter.h)
|
|
|
* Examples
|
|
|
- * [Reference【参考】](#参考)
|
|
|
- * [下拉刷新01-默认](#下拉刷新01-默认)
|
|
|
- * [下拉刷新02-动画图片](#下拉刷新02-动画图片)
|
|
|
- * [下拉刷新03-隐藏时间](#下拉刷新03-隐藏时间)
|
|
|
- * [下拉刷新04-隐藏状态和时间](#下拉刷新04-隐藏状态和时间)
|
|
|
- * [下拉刷新05-自定义文字](#下拉刷新05-自定义文字)
|
|
|
- * [下拉刷新06-自定义刷新控件](#下拉刷新06-自定义刷新控件)
|
|
|
- * [上拉刷新01-默认](#上拉刷新01-默认)
|
|
|
- * [上拉刷新02-动画图片](#上拉刷新02-动画图片)
|
|
|
- * [上拉刷新03-隐藏刷新状态的文字](#上拉刷新03-隐藏刷新状态的文字)
|
|
|
- * [上拉刷新04-全部加载完毕](#上拉刷新04-全部加载完毕)
|
|
|
- * [上拉刷新05-自定义文字](#上拉刷新05-自定义文字)
|
|
|
- * [上拉刷新06-加载后隐藏](#上拉刷新06-加载后隐藏)
|
|
|
- * [上拉刷新07-自动回弹的上拉01](#上拉刷新07-自动回弹的上拉01)
|
|
|
- * [上拉刷新08-自动回弹的上拉02](#上拉刷新08-自动回弹的上拉02)
|
|
|
- * [上拉刷新09-自定义刷新控件(自动刷新)](#上拉刷新09-自定义刷新控件(自动刷新))
|
|
|
- * [上拉刷新10-自定义刷新控件(自动回弹)](#上拉刷新10-自定义刷新控件(自动回弹))
|
|
|
- * [UICollectionView01-上下拉刷新](#UICollectionView01-上下拉刷新)
|
|
|
- * [UIWebView01-下拉刷新](#UIWebView01-下拉刷新)
|
|
|
-* [期待](#期待)
|
|
|
-
|
|
|
-## <a id="支持哪些控件的刷新"></a>支持哪些控件的刷新
|
|
|
+ * [Reference](#Reference)
|
|
|
+ * [The drop-down refresh 01-Default](#The drop-down refresh 01-Default)
|
|
|
+ * [The drop-down refresh 02-Animation image](#The drop-down refresh 02-Animation image)
|
|
|
+ * [The drop-down refresh 03-Hide the time](#The drop-down refresh 03-Hide the time)
|
|
|
+ * [The drop-down refresh 04-Hide status and time](#The drop-down refresh 04-Hide status and time)
|
|
|
+ * [The drop-down refresh 05-DIY title](#The drop-down refresh 05-DIY title)
|
|
|
+ * [The drop-down refresh 06-DIY the control of refresh](#The drop-down refresh 06-DIY the control of refresh)
|
|
|
+ * [The pull to refresh 01-Default](#The pull to refresh 01-Default)
|
|
|
+ * [The pull to refresh 02-Animation image](#The pull to refresh 02-Animation image)
|
|
|
+ * [The pull to refresh 03-Hide the title of refresh status](#The pull to refresh 03-Hide the title of refresh status)
|
|
|
+ * [The pull to refresh 04-All loaded](#The pull to refresh 04-All loaded)
|
|
|
+ * [The pull to refresh 05-DIY title](#The pull to refresh 05-DIY title)
|
|
|
+ * [The pull to refresh 06-Hidden After loaded](#The pull to refresh 06-Hidden After loaded)
|
|
|
+ * [The pull to refresh 07-Automatic back of the pull01](#上The pull to refresh 07-Automatic back of the pull01)
|
|
|
+ * [The pull to refresh 08-Automatic back of the pull02](#The pull to refresh 08-Automatic back of the pull02)
|
|
|
+ * [The pull to refresh 09-DIY the control of refresh(Automatic refresh)](#The pull to refresh 09-DIY the control of refresh(Automatic refresh))
|
|
|
+ * [The pull to refresh 10-DIY the control of refresh(Automatic back)](#The pull to refresh 10-DIY the control of refresh(Automatic back))
|
|
|
+ * [UICollectionView01-The pull and drop-down refresh](#UICollectionView01-The pull and drop-down refresh)
|
|
|
+ * [UIWebView01-The drop-down refresh](#UIWebView01-The drop-down refresh)
|
|
|
+* [Hope](#Hope)
|
|
|
+
|
|
|
+## <a id="Support what kinds of controls to refresh"></a>Support what kinds of controls to refresh
|
|
|
* `UIScrollView`、`UITableView`、`UICollectionView`、`UIWebView`
|
|
|
|
|
|
-## <a id="如何使用MJRefresh"></a>如何使用MJRefresh
|
|
|
-* cocoapods导入:`pod 'MJRefresh'`
|
|
|
-* 手动导入:
|
|
|
- * 将`MJRefresh`文件夹中的所有文件拽入项目中
|
|
|
- * 导入主头文件:`#import "MJRefresh.h"`
|
|
|
+## <a id="How to use MJRefresh"></a>How to use MJRefresh
|
|
|
+* Installation with CocoaPods:`pod 'MJRefresh'`
|
|
|
+* Manual import:
|
|
|
+ * Drag All files in the `MJRefresh` folder to project
|
|
|
+ * Import the main file:`#import "MJRefresh.h"`
|
|
|
|
|
|
```objc
|
|
|
Base Custom
|
|
|
@@ -54,41 +53,42 @@ UIScrollView+MJRefresh.h UIScrollView+MJRefresh.m
|
|
|
UIView+MJExtension.h UIView+MJExtension.m
|
|
|
```
|
|
|
|
|
|
-## <a id="已经超过上百个App正在使用MJRefresh"></a>已经超过上百个App正在使用MJRefresh
|
|
|
+## <a id=">More than hundreds of Apps are using MJRefresh"></a>More than hundreds of Apps are using MJRefresh
|
|
|
<img src="http://images0.cnblogs.com/blog2015/497279/201506/141212365041650.png" width="200" height="300">
|
|
|
-* 更多App信息可以关注:[M了个J-博客园](http://www.cnblogs.com/mjios/p/4409853.html)
|
|
|
+* More information of App can focus on:[M了个J-博客园](http://www.cnblogs.com/mjios/p/4409853.html)
|
|
|
|
|
|
-## <a id="MJRefresh类结构图"></a>MJRefresh类结构图
|
|
|
+## <a id="The Class Structure Chart of MJRefresh"></a>The Class Structure Chart of MJRefres
|
|
|

|
|
|
-- 图中`红色文字的类`:可以直接拿来用
|
|
|
- - 下拉刷新控件的种类
|
|
|
- - 默认(Normal):`MJRefreshNormalHeader`
|
|
|
- - 动图(Gif):`MJRefreshGifHeader`
|
|
|
- - 上拉刷新控件的种类
|
|
|
- - 自动刷新(Auto)
|
|
|
- - 默认(Normal):`MJRefreshAutoNormalFooter`
|
|
|
- - 动图(Gif):`MJRefreshAutoGifFooter`
|
|
|
- - 自动回弹(Back)
|
|
|
- - 默认(Normal):`MJRefreshBackNormalFooter`
|
|
|
- - 动图(Gif):`MJRefreshBackGifFooter`
|
|
|
-- 图中`非红色文字的类`:拿来继承,用于自定义刷新控件
|
|
|
-- 关于如何自定义刷新控件,可以参考下图的类<br>
|
|
|
+- `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<br>
|
|
|
<img src="http://images0.cnblogs.com/blog2015/497279/201506/141358159107893.png" width="30%" height="30%">
|
|
|
|
|
|
## <a id="MJRefreshComponent.h"></a>MJRefreshComponent.h
|
|
|
```objc
|
|
|
-/** 刷新控件的基类 */
|
|
|
+/** The Base Class of refresh control */
|
|
|
@interface MJRefreshComponent : UIView
|
|
|
-#pragma mark - 刷新状态控制
|
|
|
-/** 进入刷新状态 */
|
|
|
+#pragma mark - Control the state of Refresh
|
|
|
+
|
|
|
+/** BeginRefreshing */
|
|
|
- (void)beginRefreshing;
|
|
|
-/** 结束刷新状态 */
|
|
|
-- (void)endRefreshing;
|
|
|
-/** 是否正在刷新 */
|
|
|
+/** EndRefreshing */
|
|
|
+- (void)endRefreshing;
|
|
|
+/** IsRefreshing */
|
|
|
- (BOOL)isRefreshing;
|
|
|
|
|
|
-#pragma mark - 其他
|
|
|
-/** 根据拖拽比例自动切换透明度 */
|
|
|
+#pragma mark - Other
|
|
|
+/** According to the drag ratio to change alpha automatically */
|
|
|
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
|
|
|
@end
|
|
|
```
|
|
|
@@ -96,17 +96,17 @@ UIView+MJExtension.h UIView+MJExtension.m
|
|
|
## <a id="MJRefreshHeader.h"></a>MJRefreshHeader.h
|
|
|
```objc
|
|
|
@interface MJRefreshHeader : MJRefreshComponent
|
|
|
-/** 创建header */
|
|
|
+/** Creat header */
|
|
|
+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
|
|
|
-/** 创建header */
|
|
|
+/** Creat header */
|
|
|
+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
|
|
|
|
|
|
-/** 这个key用来存储上一次下拉刷新成功的时间 */
|
|
|
+/** This key is used to storage the time that the last time of drown-down successfully */
|
|
|
@property (copy, nonatomic) NSString *lastUpdatedTimeKey;
|
|
|
-/** 上一次下拉刷新成功的时间 */
|
|
|
+/** The last time of drown-down successfully */
|
|
|
@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;
|
|
|
|
|
|
-/** 忽略多少scrollView的contentInset的top */
|
|
|
+/** Ignored scrollView contentInset top */
|
|
|
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;
|
|
|
@end
|
|
|
```
|
|
|
@@ -114,20 +114,20 @@ UIView+MJExtension.h UIView+MJExtension.m
|
|
|
## <a id="MJRefreshFooter.h"></a>MJRefreshFooter.h
|
|
|
```objc
|
|
|
@interface MJRefreshFooter : MJRefreshComponent
|
|
|
-/** 创建footer */
|
|
|
+/** Creat footer */
|
|
|
+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
|
|
|
-/** 创建footer */
|
|
|
+/** Creat footer */
|
|
|
+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
|
|
|
|
|
|
-/** 提示没有更多的数据 */
|
|
|
-- (void)endRefreshingWithNoMoreData;
|
|
|
-/** 重置没有更多的数据(消除没有更多数据的状态) */
|
|
|
+/** NoticeNoMoreData */
|
|
|
+- (void)noticeNoMoreData;
|
|
|
+/** ResetNoMoreData(Clear the status of NoMoreData ) */
|
|
|
- (void)resetNoMoreData;
|
|
|
|
|
|
-/** 忽略多少scrollView的contentInset的bottom */
|
|
|
+/** Ignored scrollView contentInset bottom */
|
|
|
@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;
|
|
|
|
|
|
-/** 自动根据有无数据来显示和隐藏(有数据就显示,没有数据隐藏) */
|
|
|
+/** Automaticlly show or hidden by the count of data(Show-have data,Hidden- no data) */
|
|
|
@property (assign, nonatomic) BOOL automaticallyHidden;
|
|
|
@end
|
|
|
```
|
|
|
@@ -135,224 +135,228 @@ UIView+MJExtension.h UIView+MJExtension.m
|
|
|
## <a id="MJRefreshAutoFooter.h"></a>MJRefreshAutoFooter.h
|
|
|
```objc
|
|
|
@interface MJRefreshAutoFooter : MJRefreshFooter
|
|
|
-/** 是否自动刷新(默认为YES) */
|
|
|
+/** Is Automatically Refresh(Default is Yes) */
|
|
|
@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;
|
|
|
|
|
|
-/** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
|
|
|
+/** When there is much at the bottom of the control is automatically refresh(Default is 1.0,Is at the bottom of the control appears in full, will refresh automatically) */
|
|
|
@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
-## <a id="参考"></a>参考
|
|
|
+## <a id="Reference"></a>Reference
|
|
|
```objc
|
|
|
-* 由于这个框架的功能较多,就不写具体文字描述其用法
|
|
|
-* 大家可以直接参考示例中的MJTableViewController、MJCollectionViewController、MJWebViewController,更为直观快速
|
|
|
+* 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.
|
|
|
```
|
|
|
<img src="http://images0.cnblogs.com/blog2015/497279/201506/141345470048120.png" width="30%" height="30%">
|
|
|
|
|
|
-## <a id="下拉刷新01-默认"></a>下拉刷新01-默认
|
|
|
+## <a id="The drop-down refresh 01-Default"></a>The drop-down refresh 01-Default
|
|
|
+
|
|
|
```objc
|
|
|
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
|
- // 进入刷新状态后会自动调用这个block
|
|
|
+ //Call this Block When enter the refresh status automatically
|
|
|
}];
|
|
|
或
|
|
|
-// 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadNewData方法)
|
|
|
+// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
|
|
|
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
|
|
|
|
|
|
-// 马上进入刷新状态
|
|
|
+// Enter the refresh status immediately
|
|
|
[self.tableView.header beginRefreshing];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="下拉刷新02-动画图片"></a>下拉刷新02-动画图片
|
|
|
+## <a id="The drop-down refresh 02-Animation image"></a>The drop-down refresh 02-Animation image
|
|
|
```objc
|
|
|
-// 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadNewData方法)
|
|
|
+// Set the callback(一Once you enter the refresh status,then call the action of target,that is call [self loadNewData])
|
|
|
MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
|
|
|
-// 设置普通状态的动画图片
|
|
|
+// Set the ordinary state of animated images
|
|
|
[header setImages:idleImages forState:MJRefreshStateIdle];
|
|
|
-// 设置即将刷新状态的动画图片(一松开就会刷新的状态)
|
|
|
+// Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
|
|
|
[header setImages:pullingImages forState:MJRefreshStatePulling];
|
|
|
-// 设置正在刷新状态的动画图片
|
|
|
+// Set the refreshing state of animated images
|
|
|
[header setImages:refreshingImages forState:MJRefreshStateRefreshing];
|
|
|
-// 设置header
|
|
|
+// Set header
|
|
|
self.tableView.mj_header = header;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="下拉刷新03-隐藏时间"></a>下拉刷新03-隐藏时间
|
|
|
+## <a id="The drop-down refresh 03-Hide the time"></a>The drop-down refresh 03-Hide the time
|
|
|
```objc
|
|
|
-// 隐藏时间
|
|
|
+// Hide the time
|
|
|
header.lastUpdatedTimeLabel.hidden = YES;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="下拉刷新04-隐藏状态和时间"></a>下拉刷新04-隐藏状态和时间
|
|
|
+## <a id="The drop-down refresh 04-Hide status and time"></a>The drop-down refresh 04-Hide status and time
|
|
|
```objc
|
|
|
-// 隐藏时间
|
|
|
+// Hide the time
|
|
|
header.lastUpdatedTimeLabel.hidden = YES;
|
|
|
|
|
|
-// 隐藏状态
|
|
|
+// Hide the status
|
|
|
header.stateLabel.hidden = YES;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="下拉刷新05-自定义文字"></a>下拉刷新05-自定义文字
|
|
|
+## <a id="The drop-down refresh 05-DIY title"></a>The drop-down refresh 05-DIY title
|
|
|
```objc
|
|
|
-// 设置文字
|
|
|
+// Set title
|
|
|
[header setTitle:@"Pull down to refresh" forState:MJRefreshStateIdle];
|
|
|
[header setTitle:@"Release to refresh" forState:MJRefreshStatePulling];
|
|
|
[header setTitle:@"Loading ..." forState:MJRefreshStateRefreshing];
|
|
|
|
|
|
-// 设置字体
|
|
|
+// Set font
|
|
|
header.stateLabel.font = [UIFont systemFontOfSize:15];
|
|
|
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];
|
|
|
|
|
|
-// 设置颜色
|
|
|
+// Set textColor
|
|
|
header.stateLabel.textColor = [UIColor redColor];
|
|
|
header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="下拉刷新06-自定义刷新控件"></a>下拉刷新06-自定义刷新控件
|
|
|
+## <a id="The drop-down refresh 06-DIY the control of refresh"></a>The drop-down refresh 06-DIY the control of refresh
|
|
|
```objc
|
|
|
self.tableView.mj_header = [MJDIYHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
|
|
|
-// 具体实现参考MJDIYHeader.h和MJDIYHeader.m
|
|
|
+// Implementation reference to MJDIYHeader.h和MJDIYHeader.m
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新01-默认"></a>上拉刷新01-默认
|
|
|
+## <a id="The pull to refresh 01-Default"></a>The pull to refresh 01-Default
|
|
|
```objc
|
|
|
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
|
|
|
- // 进入刷新状态后会自动调用这个block
|
|
|
+ //Call this Block When enter the refresh status automatically
|
|
|
}];
|
|
|
或
|
|
|
-// 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadMoreData方法)
|
|
|
+// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
|
|
|
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新02-动画图片"></a>上拉刷新02-动画图片
|
|
|
+## <a id="The pull to refresh 02-Animation image"></a>The pull to refresh 02-Animation image
|
|
|
```objc
|
|
|
-// 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadMoreData方法)
|
|
|
+// Set the callback(Once you enter the refresh status,then call the action of target,that is call [self loadMoreData])
|
|
|
MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
|
|
|
-// 设置刷新图片
|
|
|
+// Set the refresh image
|
|
|
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
|
|
|
|
|
|
-// 设置尾部
|
|
|
+// Set footer
|
|
|
self.tableView.mj_footer = footer;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新03-隐藏刷新状态的文字"></a>上拉刷新03-隐藏刷新状态的文字
|
|
|
+## <a id="The pull to refresh 03-Hide the title of refresh status"></a>The pull to refresh 03-Hide the title of refresh status
|
|
|
```objc
|
|
|
-// 隐藏刷新状态的文字
|
|
|
+// Hide the title of refresh status
|
|
|
footer.refreshingTitleHidden = YES;
|
|
|
-// 如果没有上面的方法,就用footer.stateLabel.hidden = YES;
|
|
|
+// If does have not above method,then use footer.stateLabel.hidden = YES;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新04-全部加载完毕"></a>上拉刷新04-全部加载完毕
|
|
|
+## <a id="The pull to refresh 04-All loaded"></a>The pull to refresh 04-All loaded
|
|
|
```objc
|
|
|
-// 变为没有更多数据的状态
|
|
|
-[footer endRefreshingWithNoMoreData];
|
|
|
+//Become the status of NoMoreData
|
|
|
+[footer noticeNoMoreData];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新05-自定义文字"></a>上拉刷新05-自定义文字
|
|
|
+## <a id="The pull to refresh 05-DIY title"></a>The pull to refresh 05-DIY title
|
|
|
```objc
|
|
|
-// 设置文字
|
|
|
+// Set title
|
|
|
[footer setTitle:@"Click or drag up to refresh" forState:MJRefreshStateIdle];
|
|
|
[footer setTitle:@"Loading more ..." forState:MJRefreshStateRefreshing];
|
|
|
[footer setTitle:@"No more data" forState:MJRefreshStateNoMoreData];
|
|
|
|
|
|
-// 设置字体
|
|
|
+// Set font
|
|
|
footer.stateLabel.font = [UIFont systemFontOfSize:17];
|
|
|
|
|
|
-// 设置颜色
|
|
|
+// Set textColor
|
|
|
footer.stateLabel.textColor = [UIColor blueColor];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新06-加载后隐藏"></a>上拉刷新06-加载后隐藏
|
|
|
+## <a id="The pull to refresh 06-Hidden After loaded"></a>The pull to refresh 06-Hidden After loaded
|
|
|
```objc
|
|
|
-// 隐藏当前的上拉刷新控件
|
|
|
+//Hidden current control of the pull to refresh
|
|
|
self.tableView.mj_footer.hidden = YES;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新07-自动回弹的上拉01"></a>上拉刷新07-自动回弹的上拉01
|
|
|
+## <a id="The pull to refresh 07-Automatic back of the pull01"></a>The pull to refresh 07-Automatic back of the pull01
|
|
|
```objc
|
|
|
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新08-自动回弹的上拉02"></a>上拉刷新08-自动回弹的上拉02
|
|
|
+## <a id="The pull to refresh 08-Automatic back of the pull02"></a>The pull to refresh 08-Automatic back of the pull02
|
|
|
```objc
|
|
|
MJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
|
|
|
-// 设置普通状态的动画图片
|
|
|
+// Set the normal state of the animated image
|
|
|
[footer setImages:idleImages forState:MJRefreshStateIdle];
|
|
|
-// 设置即将刷新状态的动画图片(一松开就会刷新的状态)
|
|
|
+// Set the pulling state of animated images(Enter the status of refreshing as soon as loosen)
|
|
|
[footer setImages:pullingImages forState:MJRefreshStatePulling];
|
|
|
-// 设置正在刷新状态的动画图片
|
|
|
+// Set the refreshing state of animated images
|
|
|
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
|
|
|
|
|
|
-// 设置尾部
|
|
|
+// Set footer
|
|
|
self.tableView.mj_footer = footer;
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新09-自定义刷新控件(自动刷新)"></a>上拉刷新09-自定义刷新控件(自动刷新)
|
|
|
+## <a id="The pull to refresh 09-DIY the control of refresh(Automatic refresh)"></a>The pull to refresh 09-DIY the control of refresh(Automatic refresh)
|
|
|
```objc
|
|
|
self.tableView.mj_footer = [MJDIYAutoFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
-// 具体实现参考MJDIYAutoFooter.h和MJDIYAutoFooter.m
|
|
|
+// Implementation reference to MJDIYAutoFooter.h和MJDIYAutoFooter.m
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="上拉刷新10-自定义刷新控件(自动回弹)"></a>上拉刷新10-自定义刷新控件(自动回弹)
|
|
|
+## <a id="The pull to refresh 10-DIY the control of refresh(Automatic back)"></a>The pull to refresh 10-DIY the control of refresh(Automatic back)
|
|
|
```objc
|
|
|
self.tableView.mj_footer = [MJDIYBackFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
|
|
|
-// 具体实现参考MJDIYBackFooter.h和MJDIYBackFooter.m
|
|
|
+// Implementation reference to MJDIYBackFooter.h和MJDIYBackFooter.m
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="UICollectionView01-上下拉刷新"></a>UICollectionView01-上下拉刷新
|
|
|
+## <a id="UICollectionView01-The pull and drop-down refresh"></a>UICollectionView01-The pull and drop-down refresh
|
|
|
```objc
|
|
|
-// 下拉刷新
|
|
|
+// The drop-down refresh
|
|
|
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
|
- // 进入刷新状态后会自动调用这个block
|
|
|
+ //Call this Block When enter the refresh status automatically
|
|
|
}];
|
|
|
|
|
|
-// 上拉刷新
|
|
|
+// The pull to refresh
|
|
|
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
|
|
|
- // 进入刷新状态后会自动调用这个block
|
|
|
+ //Call this Block When enter the refresh status automatically
|
|
|
}];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## <a id="UIWebView01-下拉刷新"></a>UIWebView01-下拉刷新
|
|
|
+## <a id="UIWebView01-The drop-down refresh"></a>UIWebView01-The drop-down refresh
|
|
|
```objc
|
|
|
-// 添加下拉刷新控件
|
|
|
+//Add the control of The drop-down refresh
|
|
|
self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
|
- // 进入刷新状态后会自动调用这个block
|
|
|
+ //Call this Block When enter the refresh status automatically
|
|
|
}];
|
|
|
```
|
|
|

|
|
|
|
|
|
-## 提醒
|
|
|
-* 本框架纯ARC,兼容的系统>=iOS6.0、iPhone\iPad横竖屏
|
|
|
-
|
|
|
-## <a id="期待"></a>期待
|
|
|
-* 如果在使用过程中遇到BUG,希望你能Issues我,谢谢(或者尝试下载最新的框架代码看看BUG修复没有)
|
|
|
-* 如果在使用过程中发现功能不够用,希望你能Issues我,我非常想为这个框架增加更多好用的功能,谢谢
|
|
|
-* 如果你想为MJRefresh输出代码,请拼命Pull Requests我
|
|
|
-* 如果你开发的应用中用到了MJRefresh,希望你能到[CocoaControls](https://www.cocoacontrols.com/controls/mjrefresh)添加你应用的iTunes路径,我将会安装使用你的应用,并且根据众多应用的使用情况,对MJRefresh进行一个更好的设计和完善,提供更多好用的功能,谢谢
|
|
|
- * 步骤01(微信是举个例子,百度“你的应用名称 itunes”)
|
|
|
+## Remind
|
|
|
+* ARC
|
|
|
+* iOS>=6.0
|
|
|
+* iPhone \ iPad screen anyway
|
|
|
+
|
|
|
+## <a id="Hope"></a>Hope
|
|
|
+* 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 to[CocoaControls](https://www.cocoacontrols.com/controls/mjrefresh)to 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”)
|
|
|

|
|
|
- * 步骤02
|
|
|
+ * StepO2
|
|
|

|
|
|
- * 步骤03
|
|
|
+ * StepO3
|
|
|

|
|
|
- * 步骤04
|
|
|
+ * StepO4
|
|
|

|