1.加圆角
view.layer.cornerRadius = 8;
view.layer.masksToBounds = YES;
2.加单个圆角
UIBezierPath*path = [UIBezierPath bezierPathWithRoundedRect:sayWorldButton.bounds byRoundingCorners:UIRectCornerBottomLeft/*具体哪个角*/ cornerRadii:CGSizeMake(5,5)];
CAShapeLayer*la = [[CAShapeLayer alloc] init];
la.frame = <#要加圆角的控件#>.bounds;
la.path= path.CGPath;
<#要加圆角的控件#>.layer.mask = la;
3.加阴影
scanButton.layer.shadowColor= [UIColorblackColor].CGColor;//阴影的颜色
scanButton.layer.shadowOffset=CGSizeMake(1,1);//阴影的偏移量配合shadowRadius达到几条边有阴影的效果
scanButton.layer.shadowOpacity=0.5;//透明度
scanButton.layer.shadowRadius=1;//阴影大小
想要同是设置圆角和阴影
scanButton.layer.masksToBounds = YES;这个属性要去掉
4.加边框
view.layer.borderWidth = 5;
view.layer.borderColor = [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];