UIView 实现渐变色 CAGradientLayer
来源:互联网 发布:怎样延长淘宝收货时间 编辑:程序博客网 时间:2024/06/04 18:56
- (UIView *)sendView {
if (_sendView == nil) {
_sendView = [[UILabel alloc]init];
_sendView.frame = CGRectMake(0, 0, KScreenWidth-40, kH(30));
/**
* 渐变设置
*/
_sendView.layer.borderWidth = 1;
_sendView.layer.cornerRadius = 4;
_sendView.layer.masksToBounds = YES;
_sendView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
_sendView.backgroundColor = [UIColor yellowColor];
//阴影
_sendView.layer.shadowColor = [[UIColor redColor] CGColor];
_sendView.layer.shadowOffset = CGSizeMake(5.0f, 5.0f); //[水平偏移, 垂直偏移]
_sendView.layer.shadowOpacity = 1.0f; // 0.0 ~ 1.0 的值
_sendView.layer.shadowRadius = 10.0f; // 阴影发散的程度
//渐变光泽
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = _sendView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor]CGColor], (id)[[UIColor lightGrayColor] CGColor], nil]; // 由上到下由白色渐变为灰色
[_sendView.layer insertSublayer:gradient atIndex:0];
[self addSubview:_sendView];
}
return _sendView;
}
if (_sendView == nil) {
_sendView = [[UILabel alloc]init];
_sendView.frame = CGRectMake(0, 0, KScreenWidth-40, kH(30));
/**
* 渐变设置
*/
_sendView.layer.borderWidth = 1;
_sendView.layer.cornerRadius = 4;
_sendView.layer.masksToBounds = YES;
_sendView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
_sendView.backgroundColor = [UIColor yellowColor];
//阴影
_sendView.layer.shadowColor = [[UIColor redColor] CGColor];
_sendView.layer.shadowOffset = CGSizeMake(5.0f, 5.0f); //[水平偏移, 垂直偏移]
_sendView.layer.shadowOpacity = 1.0f; // 0.0 ~ 1.0 的值
_sendView.layer.shadowRadius = 10.0f; // 阴影发散的程度
//渐变光泽
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = _sendView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor]CGColor], (id)[[UIColor lightGrayColor] CGColor], nil]; // 由上到下由白色渐变为灰色
[_sendView.layer insertSublayer:gradient atIndex:0];
[self addSubview:_sendView];
}
return _sendView;
}
0 0
- UIView 实现渐变色 CAGradientLayer
- iOS CAGradientLayer 实现渐变色
- CAGradientLayer实现颜色渐变
- CAGradientLayer 渐变色
- 初探CAGradientLayer——渐变色的实现
- OCiOS开发:CAGradientLayer 渐变色
- 使用CAGradientLayer绘制渐变色
- CAGradientLayer 实现颜色渐变效果简介
- CAGradientLayer 实现颜色渐变效果简介
- CAGradientLayer 实现背景颜色的渐变
- 通过CAGradientLayer制作渐变色效果
- 通过CAGradientLayer制作渐变色效果【原创】
- 通过CAGradientLayer制作渐变色效果【原创】
- Core Animation - 渐变色CAGradientLayer
- 通过CAGradientLayer制作渐变色效果【原创】
- iOS开发CAGradientLayer底部渐变色
- 借助 CAGradientLayer 可以设置渐变色的属性 实现苏宁易购首页导航栏的效果
- IOS UIView 渐变色
- 4_用户态与核心态-用两种C代码实现Linux的某个系统调用
- 链接静态文件 + flask-moment的本地化时间和日期
- hdu 5247 找连续数(思维)
- Android Studio配置问题
- eclipse环境搭建之五:Scala
- UIView 实现渐变色 CAGradientLayer
- 【NOIP2012提高组】国王游戏
- 利用java实现简单租车系统(控制台程序版)
- Swift--UINavigationController
- tcp简单传输过程分析
- EM算法
- Spark RDD 的创建 & Accumulators
- MyBatis官方教程及源码解析——类型别名、类型处理器的解析
- CAS——概述