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. 设置获取用户登录信息的Seeion类

    /** * * 保存用户上下文信息 * 还可以获取session * */ public class UserContext { public static final String USER_IN_ ...

  2. Path;Paths和Files;FileVisitor

    package filet; import java.io.FileOutputStream; import java.nio.file.FileStore; import java.nio.file ...

  3. phpqrcode实现二维码(含图片)

    ---恢复内容开始--- 1,http://phpqrcode.sourceforge.net/ 下载 2,解压以后只需要一个文件 3,原生php测试: <?php include 'phpqr ...

  4. android Application类的详细介绍(转)

    在代码中经常看到application这个类,一直不知道这个是干什么用的,今天刚好有点时间,所以进行了详细的学习. 一.先对它的整体概念解释: 在android源码中对他的描述是; * Base cl ...

  5. 【开源组件】FastDFS集群搭建与实战

    FastDFS是一个轻量级的分布式文件系统,在实际生产环境往往以集群的形式部署,保证了服务的高可用.本文重点阐述FastDFS集群的搭建和项目实战. 工作流程 上传流程图 下载流程图 基本概念可参考作 ...

  6. ZOJ 2971 Give Me the Number

    Give Me the Number Numbers in English are written down in the following way (only numbers less than  ...

  7. 深度为君剖析CTO、技术总监、首席架构师的区别

      CTO.技术总监.首席架构师的区别 经常有创业公司老板来拜访我,常常会拜托给我一句话:帮我找一个CTO. 我解释的多了,所以想把这个写下来,看看你到底需要的应该是啥. 一.高级程序员 如果你是一个 ...

  8. “System.OutOfMemoryException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理

    “System.OutOfMemoryException”类型的异常在 mscorlib.dll 中发生,但未在用户代码中进行处理 这个原因肯定不是因为程序内部的逻辑错误,或者别的什么情况. 想想,肯 ...

  9. Java jxl导入excel文件,导入的数字、身份证号码、手机号变成了科学计数法,解决方案

    原文出自:https://blog.csdn.net/seesun2012 这是一个execl文件导入数据库操作,使用jxl解析execl导入数据库过程出现了科学计数法,与想要导入的数据不匹配,以下是 ...

  10. MySQL学习基础

    MySQL是被Sun公司收购了,所以也有热咖啡图标,不过MySQL的作者后来又做了一个MariaDB,小海豚图标,也很好用. MySQL学习: <MySQL网络数据库设计与开发>(电子工业 ...