本文主要是介绍mj使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
#import "MJRefresh.h"
-
#import "MJRefresh.h"
-
@interface ViewController ()<MJRefreshBaseViewDelegate>
-
@interface ViewController ()<MJRefreshBaseViewDelegate>
-
MJRefreshFooterView *footer = [MJRefreshFooterView footer];
-
footer.scrollView = myTableView;
-
footer.delegate = self;
-
-
MJRefreshHeaderView *header = [MJRefreshHeaderView header];
-
header.scrollView = myTableView;
-
header.delegate = self;
-
MJRefreshFooterView *footer = [MJRefreshFooterView footer];
-
footer.scrollView = myTableView;
-
footer.delegate = self;
-
-
MJRefreshHeaderView *header = [MJRefreshHeaderView header];
-
header.scrollView = myTableView;
-
header.delegate = self;
-
#pragma mark - 刷新控件的代理方法
-
#pragma mark 开始进入刷新状态
-
- (void)refreshViewBeginRefreshing:(MJRefreshBaseView *)refreshView
-
{
-
NSLog(@"%@----开始进入刷新状态", refreshView.class);
-
// 2.2秒后刷新表格UI
-
[self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:2.0];
-
-
}
-
-
#pragma mark 刷新完毕
-
- (void)refreshViewEndRefreshing:(MJRefreshBaseView *)refreshView
-
{
-
NSLog(@"%@----刷新完毕", refreshView.class);
-
}
-
-
#pragma mark 监听刷新状态的改变
-
- (void)refreshView:(MJRefreshBaseView *)refreshView stateChange:(MJRefreshState)state
-
{
-
switch (state) {
-
case MJRefreshStateNormal:
-
NSLog(@"%@----切换到:普通状态", refreshView.class);
-
break;
-
-
case MJRefreshStatePulling:
-
NSLog(@"%@----切换到:松开即可刷新的状态", refreshView.class);
-
break;
-
-
case MJRefreshStateRefreshing:
-
NSLog(@"%@----切换到:正在刷新状态", refreshView.class);
-
break;
-
default:
-
break;
-
}
-
}
-
-
#pragma mark 刷新表格并且结束正在刷新状态
-
- (void)doneWithView:(MJRefreshBaseView *)refreshView
-
{
-
// 刷新表格
-
[myTableView reloadData];
-
-
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
-
[refreshView endRefreshing];
-
}
-
#pragma mark - 刷新控件的代理方法
-
#pragma mark 开始进入刷新状态
-
- (void)refreshViewBeginRefreshing:(MJRefreshBaseView *)refreshView
-
{
-
NSLog(@"%@----开始进入刷新状态", refreshView.class);
-
// 2.2秒后刷新表格UI
-
[self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:2.0];
-
-
}
-
-
#pragma mark 刷新完毕
-
- (void)refreshViewEndRefreshing:(MJRefreshBaseView *)refreshView
-
{
-
NSLog(@"%@----刷新完毕", refreshView.class);
-
}
-
-
#pragma mark 监听刷新状态的改变
-
- (void)refreshView:(MJRefreshBaseView *)refreshView stateChange:(MJRefreshState)state
-
{
-
switch (state) {
-
case MJRefreshStateNormal:
-
NSLog(@"%@----切换到:普通状态", refreshView.class);
-
break;
-
-
case MJRefreshStatePulling:
-
NSLog(@"%@----切换到:松开即可刷新的状态", refreshView.class);
-
break;
-
-
case MJRefreshStateRefreshing:
-
NSLog(@"%@----切换到:正在刷新状态", refreshView.class);
-
break;
-
default:
-
break;
-
}
-
}
-
-
#pragma mark 刷新表格并且结束正在刷新状态
-
- (void)doneWithView:(MJRefreshBaseView *)refreshView
-
{
-
// 刷新表格
-
[myTableView reloadData];
-
-
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
-
[refreshView endRefreshing];
-
}
这篇关于mj使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!