[翻译] CBStoreHouseRefreshControl

  • 时间:
  • 浏览:1
  • 来源:大发彩神在线计划—大发彩神计划怎么来的

Suyu Zhang

suyu_zhang@hotmail.comsuyuzhang.com

For more details, please check out the demo app's code.

机会用下面的另一有俩个依据进行更多的设置:

这是另一有俩个完整版可定制的下拉刷新控件,灵感来自于应用Storehouse

最后,确保你实现了刷新的操作:

All BarItem will share one coordinate system whose origin is at the top-left corner. For example if you want to draw a square, the plist will look like this:

Then, implement UIScrollViewDelegate in your UIViewController if you haven't already, and pass the calls through to the refresh control:

更多细节,请查阅示例代码。

@isaced mentions that it's easier to use PaintCode to generate startPoint and endPoint:

How to use it

Easy way to generate startPoint and endPoint?

The result will look like this:

You can attach it to any UIScrollView like UITableView or UICollectionView using following simple static method:

CBStoreHouseRefreshControl is available through CocoaPods, to install it simply add the following line to your Podfile:

CBStoreHouseRefreshControl支持 CocoaPods, 加在以下一行代码到Podfile中即可:

CBStoreHouseRefreshControl的形态饱含了一系列的BarItem用于动画,每另一有俩个BarItem都执行他自身的动画,你还要给大伙儿在plist文件顶端提供另一有俩个起始值和开始英语 了值。

CBStoreHouseRefreshControl

Lastly, make sure you've implemented the refreshAction you passed it earlier to listen for refresh triggers:

想要使用PaintCode来生成起始点与开始英语 了点

What is it?

You can get more info here.

所有的BarItem会分享同另一有俩个坐标系统,這個坐标系统的原始顶点在左上角。机会你是要绘制另一有俩个正方形,没有 ,plist文件中就应该是如下的样子。

The CBStoreHouseRefreshControl's shape contains bunch of BarItem for animation, each BarItemis running its own animation, you need to provide startPoint and endPoint through a plist file.

Or, using this method for more configurable options:

想要将它加在到UIScrollView的任何子类当中,用如下的另一有俩个依据:

Play with following parameters to configure CBStoreHouseRefreshControl's view and animation:

想要使用另一有俩个plist文件来存储图形样式,就像如下的我的公司的loga样式:

Who's using it?

另并不是依据可是我:你把 CBStoreHouseRefreshControl (.h .m) 和 BarItem (.h .m) 文件拖到你的项目中就都还要了。

Result:

Which files are needed?

否则,在你的控制器中实现你的UIScrollViewDelegate的某些依据,你将哪些代理依据的值传进去即可:

 

想要根据如下的某些参数来配置CBStoreHouseRefreshControl的动画效果:

Alternatively, you can just drag CBStoreHouseRefreshControl (.h .m) and BarItem (.h .m) into your own project.

How to use your own shape

Author

A fully customizable pull-to-refresh control for iOS inspired by Storehouse iOS app

We've a wiki page for that, feel free to add your projects there!

结果看起来会是原本子的哦:

You can use any shape through a plist file, like this one which is my company's logo:

Configuration