[翻译] PQFCustomLoaders
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 hide
it 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的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- javac之Method Invocation Expressions
15.12.1. Compile-Time Step 1: Determine Class or Interface to Search 15.12.2. Compile-Time Step 2: D ...
- svn 被锁,清理恢复过程
svn 被锁,清理恢复过程 http://stackoverflow.com/questions/18000363/tortoisesvn-wont-allow-me-to-add-any-files ...
- ubuntu关闭时间同步与centos更改时间
环境:ubuntu 源于一次项目需要修改系统时间,但是每次修改后又被同步回网络时间,找了好久发现是这个原因: NTP即Network Time Protocol(网络时间协议),是一个互联网协议,用于 ...
- MySQL数据库-错误1166 - Incorrect column name 'xxx' 的解决方法
在用Navicat for MySQL给MySQL数据库修改表的字段时报如下的错误: 解决方法:检查字段里面是不是有空格,去掉就可以了.
- JavaScript自动化构建工具grunt、gulp、webpack介绍
前端开发自动化工作流工具,JavaScript自动化构建工具grunt.gulp.webpack介绍 前端自动化,这样的一个名词听起来非常的有吸引力,向往力.当今时代,前端工程师需要维护的代码变得及为 ...
- 【转载】Vue 2.x 实战之后台管理系统开发(二)
2. 常见需求 01. 父子组件通信 a. 父 -> 子(父组件传递数据给子组件) 使用 props,具体查看文档 - 使用 Prop 传递数据(cn.vuejs.org/v2/guide/co ...
- java web工程web.xml介绍
转载自:http://blog.csdn.net/believejava/article/details/43229361 Web.xml详解: 1.web.xml加载过程(步骤) 首先简单讲一下,w ...
- 《JavaWeb从入门到改行》多重外键关系在java中的处理方案
目录:(点击红色方框展开子目录) 问题描述 无 项目案例说明 业务描述 数据库说明 项目源码及下载 无 问题描述 如上两图,数据库中各个表之间有很多的外键关系,其中业务关系是一个用户下有该用户的订单, ...
- 常用SEO优化
- line-height和height的区别
line-height 是指每行的高度, 假如定义p标签的行高为line-heigth:20px; 文字在浏览器中显示为一行时,这个p标签的高度会为20px,如果为两行,则p标签的高度为40px; l ...