CGRect gradientRect=CGRectMake(- imageView3.bounds.size.width*1.5, ,  * imageView3.bounds.size.width, imageView3.bounds.size.height);
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame =gradientRect;
gradientLayer.colors = @[(id)hexColor(bb975e).CGColor,(id)[UIColor whiteColor].CGColor,(id)hexColor(bb975e).CGColor];
gradientLayer.locations = @[@(0.25),@(0.5),@(0.75)];
gradientLayer.startPoint = CGPointMake(, 0.5);
gradientLayer.endPoint = CGPointMake(, 0.5);
gradientLayer.position = CGPointMake(imageView3.bounds.size.width*0.5, imageView3.bounds.size.height/2.0);
[imageView3.layer addSublayer:gradientLayer]; CALayer *maskLayer = [CALayer layer];
maskLayer.frame =CGRectOffset(imageView3.bounds, imageView3.bounds.size.width*1.5, );
maskLayer.contents = (__bridge id)([UIImage imageNamed:@"launchImage3"].CGImage);
gradientLayer.mask = maskLayer; CABasicAnimation* fadeAnim = [CABasicAnimation animationWithKeyPath:@"locations"];
fadeAnim.fromValue = @[@(0.0),@(0.0),@(0.25)];
fadeAnim.toValue = @[@(0.75),@(1.0),@(1.0)];
fadeAnim.duration=;
fadeAnim.repeatCount = CGFLOAT_MAX;
[gradientLayer addAnimation:fadeAnim forKey:nil];

UIView 添加闪烁的渐变光的更多相关文章

  1. 【Swift 2.1】为 UIView 添加点击事件和点击效果

    前言 UIView 不像 UIButton 加了点击事件就会有点击效果,体验要差不少,这里分别通过自定义和扩展来实现类似 UIButton 的效果. 声明 欢迎转载,但请保留文章原始出处:) 博客园: ...

  2. 给UIView添加手势

    对于不能addTarget的UI对象,添加手势为他们带来了“福音”,以为UIView添加手势为例,揭开手势的面目. 1,创建一个view先, UIView * jrView=[[UIViewalloc ...

  3. iOS 中 为UIView添加背景图片

    创建UIImage的方法有两种: UIImage *image = [UIImageimageNamed:@"image.jpg"];//这种不释放内存,要缓存 NSString ...

  4. [BS-29] 给UIView添加背景图片

    给UIView添加背景图片 //默认情况下只能设置UIView的背景颜色,不能给UIView设置背景图片,但通过绘图知识可以做到 - (void)drawRect:(CGRect)rect { [su ...

  5. IOS学习之路十五(UIView 添加背景图片以及加边框)

    怎样给UIview添加背景图片呢很简单,就是先给view添加一个subview,然后设为背景图片: 效果图如下: 很简单直接上代码: //设置内容 self.myTopView.backgroundC ...

  6. UIView添加支持代码块的手势

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(a ...

  7. IOS UIView圆角,阴影,边框,渐增光泽

    圆角 sampleView.layer.cornerRadius = 2.5; // 圓角的弧度sampleView.layer.masksToBounds = YES; 阴影 sampleView. ...

  8. IOS开发之功能模块--给任意的UIView添加点击事件

    前言:好久没写博客,今天来一波.我在实际项目开发中,会遇到这样功能需求:我已经搭好了iOS的UI界面,但是很多界面的子View用了UIView,然后这些UIView中用了UILabel和UIImage ...

  9. swift为UIView添加extension扩展frame

    添加swift file:UIView+Extension import UIKit extension UIView { // x var x : CGFloat { get { return fr ...

随机推荐

  1. unlimited 控制

  2. 使用级联分类器实现人脸检测(OpenCV自带的数据)

    #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...

  3. css动画,展开折叠图标

    @keyframes packupArrowFlow { 0% { bottom:; } 70% { bottom: 10px; } } @-webkit-keyframes packupArrowF ...

  4. python 爬虫--同花顺-使用代理

    1.http://www.goubanjia.com/  在上面获取 使用http协议的公网IP和端口 参考:https://blog.csdn.net/qq_23934063/article/det ...

  5. day 43

    今日内容 1.视图 2.事务 3.SQL注入问题 4.存储过程 首先回顾一下昨天所学 子查询: in (select a where 字段名 in select b) exists(判断后面语句执行结 ...

  6. vi 格式配置

    echo set cursorline >>.vimrcecho set ic >>.vimrcecho set nu >>.vimrc

  7. sql语句截取字符串

    Postgresql 当中有四种方式获取当前时间.  一:now()      通过now()获取的时间是最完整的时间,包括时区,秒也保留到了6位小数.      select now();     ...

  8. vb用createprocess启动其他应用程序

    Option Explicit Private Type PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessId As Lon ...

  9. Sqlite 快速批量插入数据 测试

    public static int insertDbBatch() { string sql = ""; SQLiteConnection conn = new SQLiteCon ...

  10. 20155206赵飞 基于《Arm试验箱的国密算法应用》课程设计个人报告

    20155206赵飞 基于<Arm试验箱的国密算法应用>课程设计个人报告 课程设计中承担的任务 完成试验箱测试功能1,2,3 . 1:LED闪烁实验 一.实验目的  学习GPIO原理  ...