RCLighting

https://github.com/RidgeCorn/RCLighting

效果:

真机测试的效率:

看了源码,其实原理很简单:

================================

1. 实现UIView的category

2. 继承了一个CALayer

3. 将这个继承的CALayer插入到UIView的subLayer中

4. 对这个layer进行动画操作

================================

源码:

//
// RootViewController.m
// Lighting
//
// Copyright (c) 2014年 Y.X. All rights reserved.
// #import "RootViewController.h"
#import "RCLighting.h" @interface RootViewController () @end @implementation RootViewController - (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor]; // 辉光view
UIView *showView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
showView.alpha = 0.8f;
showView.backgroundColor = [UIColor redColor];
showView.center = self.view.center;
[self.view addSubview:showView];
[showView showLightingWithColors:@[[UIColor brownColor],
[UIColor greenColor],
[UIColor cyanColor],
[UIColor orangeColor],
[UIColor purpleColor],
[UIColor magentaColor],
[UIColor redColor],
[UIColor yellowColor],
[UIColor blueColor]]]; // 中间显示字体
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.font = [UIFont fontWithName:@"HelveticaNeue-UltraLight"
size:.f];
label.text = @"YouXianMing";
label.center = self.view.center;
[self.view addSubview:label];
} @end

注意哦,源码中有用到POP库动画

RCLighting的更多相关文章

随机推荐

  1. 关于function构造函数特别注意的

    function在javascript中是对象,所以function持有构造函数例子:var a = new Function("x","y","re ...

  2. 多线程编程(四)-CyclicBarrier的使用

    CyclicBarrier的介绍 类CyclicBarrier不仅有CountDownLatch所具有的功能,还可以是啊县屏障等待的功能,也就是阶段性同步,它在使用上的意义在与可以循环地实现线程要一起 ...

  3. R语言 删除变量rm函数

    变量可以通过使用 rm()函数来删除.下面我们删除变量var.3.然后再打印变量时出现异常错误. rm(var.3) print(var.3) 当上面的代码执行时,它产生以下结果: [1] " ...

  4. git 切换 远程仓库

    $ git remote rm origin $ git remote add origin '仓库地址.git' $ git branch --set-upstream-to=origin/mast ...

  5. 使用AngularJS 添加行修改、删除表格数据

    https://blog.csdn.net/xin_x1n/article/details/53070144 <html xmlns="http://www.w3.org/1999/x ...

  6. Toolstrip 工具栏控件

    工具栏是另一种获取应用程序主要功能的常用方法,比起菜单更直观.   Tool strip 控件是由system.Windows.forms.Toolstrip类提供的,作用是创建易于自定义的常用工具栏 ...

  7. TabControl 选项卡控件

    TabControl 控件是由System.Windows.Forms.TabControl类提供的,作用就是讲相关的组件组合到一系列选项卡页面上.   MulitiLine 属性用来设置是否显示多行 ...

  8. SmartGit破解使用的个人方法

    转自:https://www.cnblogs.com/nn839155963/p/5912788.html SmartGit是收费的,可以30天的试用期,30天试用期过后,smartgit 需要输入序 ...

  9. 配置JDK1.7开发环境

    学习java知识,首先要安装jdk来配置开发环境和java运行环境,本文介绍一下JDK配置流程和验证配置成功的方法. 一.配置JDK 1.首先下载jdk1.7压缩包并解压到D盘. 2.我的电脑--右键 ...

  10. 基于.Net下整合RestSharp,实现REST服务客户端

    一. 准备工作 1. 点击此访问 RestSharp 官网,可作参考 2. VS2012 中安装支持.Net4.0的最新版 RestSharp 插件 工具---NuGet程序包管理器---程序包管理器 ...