在当前的viewcontroller的.h中 定义一个页数
@property(nonatomic,assign)int page;
在当前的viewcontroller的.m中
设置方法
[self initadad];
[self addheadfresh];
[self addfootfresh];
实现方法
-(void)addheadfresh{
MJRefreshGifHeader *head = [MJRefreshGifHeader headerWithRefreshingBlock:^{
self.page = 2 ;
[self.datasourse removeAllObjects];
[self qingqiu];
}];
NSArray *arr = @[[UIImage imageNamed:@“luyinshuohuashengyin”],[UIImage imageNamed:@“luyinshuohuashengyin”]];
[head setImages:arr forState:MJRefreshStateRefreshing];
[head setImages:@[[UIImage imageNamed:@“luyinshuohuashengyin”]] forState:MJRefreshStateIdle];
[head setTitle:@“正在刷新请稍等” forState:MJRefreshStateRefreshing];
self.tab.mj_header = head;
}
-(void)addfootfresh{
MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingBlock:^{
self.page++;
[self qingqiu];
}];
NSArray *arrr = @[[UIImage imageNamed:@“luyinshuohuashengyin”],[UIImage imageNamed:@“luyinshuohuashengyin”]];
[footer setImages:arrr forState:MJRefreshStateRefreshing];
self.tab.mj_footer = footer;
}
-(void)initadad{
self.page = 1;
self.datasourse = [NSMutableArray new];
}
最后。在解析方法中 成功里面添加
[self.Tab.mj_head endRefreshing];
[self.Tab.mj_footer endRefreshing];