RCLighting
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的更多相关文章
随机推荐
- hibernate树状映射
例如公司的组织机构:一个公司可以有多个子公司,一个子公司子有多个部门. 其实就是一张表, 例子程序: Organization类: package com.oracle.hibernate; impo ...
- .net core 多平台部署
首先下载地址 https://dotnet.microsoft.com/download 下载.net core 和 .net core runtime 然后安装他们 控制台运行项目: 找到你的工 ...
- 对Tensorflow中tensor的理解
Tensor即张量,在tensorflow中所有的数据都通过张量流来传输,在看代码的时候,对张量的概念很不解,很容易和矩阵弄混,今天晚上查了点资料,并深入了解了一下,简单总结一下什么是张量的阶,以及张 ...
- 2-9 js基础 cookie封装
// JavaScript Document 'use strict'; function setCookie(sName,sValue,iDay){ if(iDay){ var oDate = ne ...
- mysql查看版本
四种方式: 1. 命令行 ------------------->$ mysql -V mysql Ver , for Linux (x86_64) using EditLine wrapper ...
- Jenkins 中创建项目时没有Maven项目怎么办
如果在创建项目时候,没有“创建一个Maven 项目”的选项. 你需要安装Maven项目插件:Maven Integration plugin . 点击“可选插件” 然后在右边的过滤输入框中输入搜索关 ...
- JDBC连接Greenplum数据库,封装了增删改查
要启动好gp服务,再尝试连接 192.168.94.135是主节点(master)的ip 驱动Jar包在官网获取 嫌麻烦,可以直接用我在网盘分享的Jar包,版本较老 链接:https://pan.ba ...
- ubuntu 10.10 更新源
deb http://mirrors.163.com/ubuntu/ maverick main universe restricted multiverse deb-src http://mirro ...
- 超赞的 Go 语言 INI 文件操作
灵活的数据源 不光光可以从文件读取配置,还支持 []byte 类型的纯数据读取和基于 io.ReadCloser 的流式读取. 多种格式兼容 各种文件种类的广泛支持,包括但不限于 my.cnf..gi ...
- [转]IIS的各种身份验证详细测试
本文转自:http://www.cnblogs.com/chnking/archive/2007/11/20/965553.html#_Toc183326163 一. IIS的身份验证概述 1. ...