zoukankan      html  css  js  c++  java
  • [翻译] 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 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
    

     

  • 相关阅读:
    Log4J日志配置详解
    Linux:ssh端口转发详解
    Android数据存储五种方式总结
    Nginx学习记录
    简单通用JDBC辅助类封装
    PBR.理论
    PBR.工作流贴图
    不设置readable,读取图片数据
    直接打开指定的目录
    Compute Shader基础
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4152195.html
Copyright © 2011-2022 走看看