Coder Social home page Coder Social logo

mnman / xzmrefresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xiezhongmin/xzmrefresh

0.0 2.0 0.0 3.19 MB

The easiest way to use pull-to-The transverse refresh(非常易用的横向刷新框架与MJRefresh用法一致,支持cocoaPods,持续维护中)

License: Apache License 2.0

Ruby 0.74% Objective-C 99.26%

xzmrefresh's Introduction

iOS使用XZMRefresh实现UITableView或UICollectionView横向刷新

The easiest way to use pull-to-The transverse refresh(非常易用的横向刷新框架与MJRefresh用法一致) #框架开发的缘由:

现今已有越来越多的APP需要横向刷新的需求,然而MJRefresh已不能满足该需求,该框架已经使用的非常的广泛,并且框架本身封装比较完美,方法的使用大家也非常的熟悉,所以XZMRefresh本着模仿MJRefresh框架做了横向刷新的Refresh,这样大家不必再去适应繁琐的新框架集成。

##APP实例 ###1.好赞APP (好赞刷新)

###2.淘宝APP (淘宝刷新)

Content

如何使用XZMRefresh

  • cocoapods导入:pod 'XZMRefresh'
  • 手动导入:
  • XZMRefresh文件夹中的所有文件拽入项目中
  • 导入主头文件:#import "XZMRefresh.h"
  • 下拉刷新控件的种类
  • 默认(Normal):XZMRefreshNormalHeader
  • 动图(Gif):XZMRefreshGifHeader
  • 上拉刷新控件的种类
  • 默认(Normal):XZMRefreshNormalFooter
  • 动图(Gif):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];

(自定义文字)

特性说明

  • 本框架纯ARC,兼容的系统>=iOS6.0
  • 如果在使用过程中遇到BUG,希望你能与我联系(我的邮箱:364101515qq.com)
  • 如果有好的建议以及框架上的不足,请联系我,非常感谢你!
  • 如果喜欢你就Star一下吧,感谢你的支持!

xzmrefresh's People

Contributors

xiezhongmin avatar

Watchers

James Cloos avatar MN avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.