美文网首页
UIview 加阴影加圆角加边框

UIview 加阴影加圆角加边框

作者: CreateTian | 来源:发表于2018-01-13 22:03 被阅读0次

1. 加阴影,首先导入框架#import<QuartzCore/QuartzCore>

self.bootomView.layer.shadowOpacity = 0.5;// 阴影透明度
self.bootomView.layer.shadowColor = [UIColor grayColor].CGColor;// 阴影的颜色
self.bootomView.layer.shadowRadius = 3;// 阴影扩散的范围控制
self.bootomView.layer.shadowOffset  = CGSizeMake(1, 1);// 阴影的范围

2. 加圆角,首先保证你的imageVIew是正方形的,要不然效果不是圆的

self.userImage.layer.masksToBounds = YES;
self.userImage.layer.cornerRadius = self.userImage.frame.size.width / 2;

如果想要有点弧度的不是地球那么圆的可以设置
self.userImage.layer.cornerRadius =5;这个值越大弧度越大

3.加边框

self.goingButn.layer.borderColor = [UIColor redColor].CGColor;//边框颜色
self.goingButn.layer.borderWidth = 2;//边框宽度

相关文章

网友评论

      本文标题:UIview 加阴影加圆角加边框

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