TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Mar 2016 |
Maintained by xie1988.
The easiest way to use pull-to-The transverse refresh(非常易用的横向刷新框架与MJRefresh用法一致)
pod 'XZMRefresh'
XZMRefresh
文件夹中的所有文件拽入项目中导入主头文件:#import "XZMRefresh.h"
下拉刷新控件的种类
XZMRefreshNormalHeader
XZMRefreshGifHeader
XZMRefreshNormalFooter
XZMRefreshGifFooter
#pragma mark UICollectionView + 默认刷新
[self.collectionView xzm_addNormalHeaderWithTarget:self action:@selector(loadNewDataWithHeader:)];
[self.collectionView xzm_addNormalFooterWithTarget:self action:@selector(loadMoreDataWithFooter:)];
// 自动刷新(一进入程序就下拉刷新)
[self.collectionView.xzm_header beginRefreshing];
}
// 隐藏时间
self.collectionView.xzm_header.updatedTimeHidden = YES;
[self.collectionView xzm_addGifHeaderWithTarget:self action:@selector(loadNewDataWithHeader:)];
[self.collectionView xzm_addGifFooterWithTarget:self action:@selector(loadMoreDataWithFooter:)];
// 设置普通状态的动画图片
NSMutableArray *idleImages = [NSMutableArray array];
for (NSUInteger i = 1; i<=60; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_anim__000%zd", i]];
[idleImages addObject:image];
}
[self.collectionView.xzm_gifHeader setImages:idleImages forState:XZMRefreshStateNormal];
[self.collectionView.xzm_gifFooter setImages:idleImages forState:XZMRefreshStateNormal];
// 设置正在刷新状态的动画图片
NSMutableArray *refreshingImages = [NSMutableArray array];
for (NSUInteger i = 1; i<=3; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_loading_0%zd", i]];
[refreshingImages addObject:image];
}
[self.collectionView.xzm_gifHeader setImages:refreshingImages forState:XZMRefreshStateRefreshing];
[self.collectionView.xzm_gifFooter setImages:refreshingImages forState:XZMRefreshStateRefreshing];
// 马上进入刷新状态
[self.collectionView.xzm_gifHeader beginRefreshing];
// 添加动画图片代码同上
// 隐藏时间
self.collectionView.xzm_gifHeader.updatedTimeHidden = YES;
// 隐藏状态
self.collectionView.xzm_gifHeader.stateHidden = YES;
self.collectionView.xzm_gifFooter.stateHidden = YES;
// 设置header文字
[self.collectionView.xzm_header setTitle:@"滑动可以刷新" forState:XZMRefreshStateNormal];
[self.collectionView.xzm_header setTitle:@"释放立即刷新" forState:XZMRefreshStatePulling];
[self.collectionView.xzm_header setTitle:@"正在刷新中 ..." forState:XZMRefreshStateRefreshing];
// 设置字体
self.collectionView.xzm_header.font = [UIFont systemFontOfSize:15];
// 设置颜色
self.collectionView.xzm_header.textColor = [UIColor redColor];
// 设置footer文字
[self.collectionView.xzm_footer setTitle:@"滑动可以刷新" forState:XZMRefreshStateNormal];
[self.collectionView.xzm_footer setTitle:@"释放立即刷新" forState:XZMRefreshStatePulling];
[self.collectionView.xzm_footer setTitle:@"正在加载中数据 ..." forState:XZMRefreshStateRefreshing];
// 设置字体
self.collectionView.xzm_footer.font = [UIFont systemFontOfSize:17];
// 设置颜色
self.collectionView.xzm_footer.textColor = [UIColor blueColor];