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的更多相关文章
随机推荐
- Tomcat的配置文件Server.xml解析
配置元素说明: 元素名 属性 解释 server port 指定一个端口,这个端口负责监听关闭tomcat 的请求 shutdown 指定向端口发送的命令字符串 service name 指定serv ...
- WPF DataTemplate與ControlTemplate
一. 前言 什麼是DataTemplate? 什麼是ControlTemplate? 在stackoverflow有句簡短的解釋 "A DataTemplate, therefore ...
- 使用Jasperreporter生成入库出库单打印等报表操作
项目需要打印报表:就是那种生成入库单,出库单等的操作.使用到的技术:使用iReport Designer5.1.0设计报表,使用struts2+jasperreporter生成最终填充数据的报表 首先 ...
- spring mongodb中去掉_class列
调用mongoTemplate的save方法时, spring-data-mongodb的TypeConverter会自动给document添加一个_class属性, 值是你保存的类名. 这种设计并没 ...
- Mysql日期类型大小比较---拉取给定时间段的记录
我们知道,mysql里边,日期类型有很多表现形式,date, datetime,timestamp等类型.考虑这样一种场景: 按时间段拉取给定时间段的内容,这时,我们就得使用日期类型的比较了. 表结构 ...
- 通配符证书导致 Outlook Anywhere 的客户端连接问题
通配符证书导致 Outlook Anywhere 的客户端连接问题 本主题介绍当您使用 Outlook Anywhere 连接到 Microsoft Exchange 及在组织中跨 Exchange ...
- Bitcoin交易及验证
目录 UTXO 理解 交易的结构 交易的确认 交易验证 逆波兰表示法 使用逆波兰表示法验证交易 UTXO 理解 未花费交易输出: Unspent Transxtion output UTXO---用比 ...
- jdbc报java.lang.ClassNotFoundException: com.mysql.jdbc.Drive
今天从开始写了一个jdbc连接mysql驱动的程序 真的是各种报错啊 首先这是代码 package com.dmeck; import java.sql.Connection; import java ...
- 出现<authentication mode="Windows"/>错误解决办法
转自:https://blog.csdn.net/clever101/article/details/39671715 网上下载的asp.net源码出现 <authentication mode ...
- C# 请求Https
/// <summary> /// Get请求 /// </summary> /// <param name="Url"></param& ...