iOS 实现渐变色
2016-01-08 17:49
615 查看
1。
#import <QuartzCore/QuartzCore.h>
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = rect;
gradient.colors = [NSArray arrayWithObjects:(id)[UIColor redColor].CGColor,
(id)[UIColor yellowColor].CGColor,
(id)[UIColor greenColor].CGColor,nil];
[self.layer insertSublayer:gradient atIndex:0];
2。
CGRect barRect=CGRectMake(xPosition, self.bounds.size.height - 180 - 13, 30, 180);
CGColorRef upColor = [UIColor colorWithRed:254/255.0 green:186/255.0 blue:187/255.0alpha:1.0].CGColor;
CGColorRef downColor = [UIColor colorWithRed:255/255.0 green:91/255.0 blue:92/255.0alpha:1.0].CGColor;
drawLinearGradient(context, barRect, upColor, downColor);
#import <QuartzCore/QuartzCore.h>
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = rect;
gradient.colors = [NSArray arrayWithObjects:(id)[UIColor redColor].CGColor,
(id)[UIColor yellowColor].CGColor,
(id)[UIColor greenColor].CGColor,nil];
[self.layer insertSublayer:gradient atIndex:0];
2。
CGRect barRect=CGRectMake(xPosition, self.bounds.size.height - 180 - 13, 30, 180);
CGColorRef upColor = [UIColor colorWithRed:254/255.0 green:186/255.0 blue:187/255.0alpha:1.0].CGColor;
CGColorRef downColor = [UIColor colorWithRed:255/255.0 green:91/255.0 blue:92/255.0alpha:1.0].CGColor;
drawLinearGradient(context, barRect, upColor, downColor);
相关文章推荐
- 把删除数组里面字典文件,然后进行倒叙,删除指定的数组元素ios考核第四题
- ios 调用系统提示音教程
- 3种隐藏键盘的方法——iOS
- ios enum to string
- ios 获取文件夹大小
- 原创翻译:蓝牙(BLE)for iOS
- iOS-设置启动页面时间
- iOS 7
- iOS- 如何集成支付宝
- 【iOS】倒计时5分钟
- CLLocationManager Delegate methods are not getting called -- ios8 later
- iOS 列表页跳转到详细页 详细页隐藏TabBar
- iOS 5
- ios实现长时间后台运行
- iOS 6
- ios--随笔一
- iOS模拟器键盘输入中文解决方案
- ios4 习题
- iOS 第七期考核题(字符串以及字典的使用 数组内容转换成字符串)
- Learning methods - 2