美文网首页
创建一个悬浮立体感的cell

创建一个悬浮立体感的cell

作者: 杨鹏_小宝 | 来源:发表于2016-11-17 11:38 被阅读35次

其实为了有立体感,只是需要在他的投影下功夫

self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, ScreenW, 100)];
self.bgView.backgroundColor = [UIColor greenColor];
self.bgView.layer.shadowOffset = CGSizeMake(2,5);
self.bgView.layer.shadowOpacity = 0.8;
设置阴影的颜色
self.bgView.layer.shadowColor = [UIColor blueColor].CGColor;
self.bgView.layer.shadowRadius = 10;
添加一张图片
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(20, 10, 80, 80)];
imageview.layer.shadowColor = [UIColor redColor].CGColor;
imageview.layer.shadowOffset = CGSizeMake(5,5);
imageview.layer.shadowOpacity = 1.0;
imageview.layer.shadowRadius = 10;
imageview.backgroundColor = [UIColor lightGrayColor];
self.imageview = imageview;
imageview.layer.borderColor = [UIColor yellowColor].CGColor;
imageview.layer.borderWidth = 3;

此处为源码地址

相关文章

网友评论

      本文标题:创建一个悬浮立体感的cell

      本文链接:https://www.haomeiwen.com/subject/tzsdpttx.html