//创建层
CALayer *layer5=[CALayer layer];
//设置层背景
layer5.backgroundColor=[[UIColor brownColor]CGColor];
//设置大小
layer5.bounds=CGRectMake(200, 200, 200, 200);
//设置位置
layer5.position=CGPointMake(200, 200);
//设置圆角
layer5.cornerRadius=20;
//设置图片
layer5.contents=(id)[UIImage imageNamed:@"mtxx1.png"].CGImage;
// layer5.anchorPoint=CGPointZero;
//设置阴影颜色
layer5.shadowColor=[[UIColor blackColor]CGColor];
//阴影偏移,x向右偏移4,y向下偏移4,默认(0, -3)
layer5.shadowOffset=CGSizeMake(10, 20);
//阴影透明度,默认0
layer5.shadowOpacity=0.6;
//阴影半径,默认3
layer5.shadowRadius = 4;
时间: 2024-11-05 15:45:05