码迷,mamicode.com
首页 > 移动开发 > 详细

iOS CAGradientLayer 颜色渐变

时间:2015-06-23 19:46:49      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

 1   CAGradientLayer *layer = [CAGradientLayer layer];
 2     layer.startPoint = (CGPoint){0.5f, 0.0f};
 3     layer.endPoint = (CGPoint){0.5f, 1.0f};
 4     layer.colors = @[(id)[UIColor purpleColor].CGColor,
 5                      (id)[UIColor cyanColor].CGColor,
 6                      (id)[UIColor magentaColor].CGColor,
 7                      (id)[UIColor redColor].CGColor];
 8     layer.locations = @[@0.0f, @0.6f, @1.0f];
 9     layer.frame = self.view.layer.bounds;
10     [self.view.layer insertSublayer:layer atIndex:0];

 

iOS CAGradientLayer 颜色渐变

标签:

原文地址:http://www.cnblogs.com/airy99/p/4595879.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!