PQFCustomLoaders

Current version: 0.0.1

Collection of highly customizable loaders for your iOS projects. Feel free to use them.

当前版本为:0.0.1

这是一个可以高度定制的加载控件,你可以随意使用。

Installation


CocoaPods

The easiest way to get started is to use CocoaPods. Just add the following line to your Podfile:

pod 'PQFCustomLoaders', '~> 0.0.1'

Import the project

If you don't want to use (you should) CocoaPods, you can download this project, and add the files in the /PQFCustomLoaders folder to your existing project.

你可以直接把文件夹导入到你的工程项目当中。

Quick Start


1. Import

The first thing is to import the main file. This file contain all the requiered imports that you are going to need (PQFBarsInCircles.h PQFBouncingBalls.h PQFCirclesInTriangles.h). If you are planning to use only one loader, you can import only the required one, it is up to you.

第一步,导入头文件,这个文件包含了所有你需要用到的内容。

#import <PQFCustomLoaders/PQFCustomLoaders.h>

2. Init a loader in a view

For example, if you are going to add the PQFBouncingBalls Loader, you have to initialize it like this. I recommend you to make a property in order to have a pointer to the loader for when you want to remove it.

例如,如果你想添加PQFBouncingBalls控件,你需要想如下的方式来初始化他。

@interface ViewController ()
... @property (nonatomic, strong) PQFBouncingBalls *bouncingBalls; ...
@end @implementation ViewController
... self.loader = [[PQFBouncingBalls alloc] initLoaderOnView:self.view]; ...
@end

In this example I am adding the loader to the main view, but you can add it to any UIView (or subclass)

你可以将这个loader添加到任何主要的view当中。

3. Customize it a little bit

You can customize this loaders a lot, in the following section (Loader Styles) you can see all the custom properties that you can change.

你可以自定义很多很多的属性。

self.loader.jumpAmount = 50;
self.loader.zoomAmount = 20;
self.loader.separation = 20;

It is very important to change all the properties before showing it (Except for the label ones).

再显示这些属性之前,先修改好属性值。

4. Show it!

When the loader is initialized, it is going to be added to the subviews of the view that you choose. But it is going to be with alpha 0.0 and with no animations activated (so no memory problems ;) ).

当这个loader初始化了,你需要把它添加到你的view当中,但是,它的alpha值为0,所以不消耗内存。

[self.loader show];

When you use the show method, you are making it visible and activating the animations

当你使用show方法后,你才会看到他。

5. Hide it or Remove it

If you are planning to reuse it, just hideit like this:

如果你想重用他,只需要隐藏即可。

[self.loader hide]

Now you can change the properties that you want before reshowing it. This method makes it invisible and stop all the animations.

此时,你可以改变属性了,以便再次显示时做出改变。

If you are not going to use it anymore, just remove it

如果你再也不想用它了,移除掉他。

[self.loader remove]

This method is going to remove it from it superview.

这个方法是用来让他从父视图中移除掉的方法。


Methods you can use:
- (instancetype)initLoaderOnView:(UIView *)view;

- (void)remove;
- (void)show;
- (void)hide;

Loader Styles


PQFBarsInCircles

Properties:

@property (nonatomic, strong) UIColor *loaderColor;
@property (nonatomic, strong) UIColor *backgroundColor; //TRANSPARENT BY DEFAULT
@property (nonatomic) CGFloat loaderAlpha;
@property (nonatomic) CGFloat cornerRadius;
@property (nonatomic) NSInteger numberOfBars; //OF THE HOLE LOADER FRAME
@property (nonatomic) CGFloat barWidthMax;
@property (nonatomic) CGFloat barHeightMax;
@property (nonatomic) CGFloat barWidthMin;
@property (nonatomic) CGFloat barHeightMin;
@property (nonatomic) CGFloat barsSpeed; //IN SECONDS (LESS AMOUNT, MORE SPEED)
@property (nonatomic) CGFloat rotationSpeed; //IN SECONDS (LESS AMOUNT, MORE SPEED)
@property (nonatomic, strong) UILabel *label; //IF YOU DON'T WANT IT, JUST DON'T CHANGE IT AND IT IS NOT GOING TO APPEAR

PQFBouncingBalls

Properties:

@property (nonatomic) CGFloat cornerRadius;     //OF THE HOLE LOADER FRAME
@property (nonatomic, strong) UIColor *backgroundColor; //TRANSPARENT BY DEFAULT
@property (nonatomic) CGFloat loaderAlpha;
@property (nonatomic, strong) UIColor *loaderColor;
@property (nonatomic) CGFloat diameter; //OF THE BALLS
@property (nonatomic) CGFloat jumpAmount; //X MOVEMENT
@property (nonatomic) CGFloat separation; //BETWEEN THE BALLS
@property (nonatomic) CGFloat zoomAmount; //SIZE = SIZE + ZOOMAMOUNT
@property (nonatomic) CGFloat duration;
@property (nonatomic, strong) UILabel *label; //IF YOU DON'T WANT IT, JUST DON'T CHANGE IT AND IT IS NOT GOING TO APPEAR

PQFCirclesInTriangle

Properties:

@property (nonatomic) NSUInteger numberOfCircles;   //YOU CAN ONLY CHOOSE 3 OR 6 AT THE MOMENT
@property (nonatomic, strong) UIColor *backgroundColor; //TRANSPARENT BY DEFAULT
@property (nonatomic) CGFloat cornerRadius; //OF THE HOLE LOADER FRAME
@property (nonatomic) CGFloat loaderAlpha;
@property (nonatomic, strong) UIColor *loaderColor;
@property (nonatomic) CGFloat maxDiam; //MAXIMUM DIAMETER OF ALL THE CIRCLES
@property (nonatomic) CGFloat separation; //DEFAULT VALUE = 8.0
@property (nonatomic) CGFloat borderWidth; //WIDTH OF THE CIRCLES
@property (nonatomic) CGFloat delay; //ONLY IF YOU USE 6 CIRCLES, DELAY BETWEEN THE FIRST 3 CIRCLES AND THE OTHERS
@property (nonatomic) CGFloat duration;
@property (nonatomic, strong) UILabel *label; //IF YOU DON'T WANT IT, JUST DON'T CHANGE IT AND IT IS NOT GOING TO APPEAR

 

[翻译] PQFCustomLoaders的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. android Application类的详细介绍(转)

    在代码中经常看到application这个类,一直不知道这个是干什么用的,今天刚好有点时间,所以进行了详细的学习. 一.先对它的整体概念解释: 在android源码中对他的描述是; * Base cl ...

  2. webpack使用 babili-webpack-plugin 报错 "original.line and original.column are not numbers"

    按照这个解决 https://github.com/chentsulin/electron-react-boilerplate/issues/1300 changing "babili-we ...

  3. 虹软linux错误

  4. memcached 学习笔记 4

    memcached真实项目中的应用 1 缓存式的Web应用程序架构 有了缓存的支持,我们可以在传统的app层和db层之间加入cache层,每个app服务器都可以绑定一个mc, 每次数据的读取都可以从m ...

  5. web工程中文字符乱码:try { res.setContentType("text/html;charset=gbk"); PrintWriter pw=res.getWriter(); ;;; }

    输入正确的name ,pwd  跳转到main 页面 证明:登录信息确认基本正确 用户名,密码不对时提示:信息错误 注意编码格式: 应设置如下:在try中设置字符编码为gbk,在try外有时出错,设置 ...

  6. Codeforces 985G. Team Players

    Description 有 \(n\) 个人 , \(m\) 对人有冲突 , 你要从这 \(n\) 个人中选出三个人成为一组 , 使得同一组的人不存在一对有冲突 题面 Solution 容斥 答案=总 ...

  7. vuex源码分析3.0.1(原创)

    前言 chapter1 store构造函数 1.constructor 2.get state和set state 3.commit 4.dispatch 5.subscribe和subscribeA ...

  8. 经典SQL分页语句

    select top pageSize, * from (SELECT row_number() over(order by id desc) as rownumber,*FROM tb1) A wh ...

  9. sql sever 执行较大的文件脚本

    1.用管理员身份打开cmd工具 2.执行命令 osql -S  localhost -U sa -P 123456 -i D:/test.sql -S 服务器地址  本地可简写 . -U 用户名 -P ...

  10. OC与JS交互之WKWebView

    上一篇文章我们使用了JavaScriptCore框架重写了之前的示例,iOS8苹果偏爱HTML5,重构了UIWebVIew,给我们带来了WKWebView,使其性能.稳定性.功能大幅度提升,也更好的支 ...