CALayer *superLayer=self.view.layer;
//创建CALayer
CALayer *subLayer =[CALayer layer];
//添加到父图层
[superLayer addSublayer:subLayer];
//尺寸
subLayer.bounds =CGRectMake(0, 0, 200, 200);
//颜色
subLayer.backgroundColor =[UIColor greenColor].CGColor;
//位置
subLayer.position=CGPointMake(100, 100);
//锚点
subLayer.anchorPoint =CGPointMake(0 , 0);
//圆角
subLayer.cornerRadius =100;
//context内容
UIImage *image =[UIImage imageNamed:@"b"];
subLayer.contents =(__bridge id)(image.CGImage);
//边界剪裁
subLayer.masksToBounds =YES;
//创建CALayer
CALayer *subLayer =[CALayer layer];
//添加到父图层
[superLayer addSublayer:subLayer];
//尺寸
subLayer.bounds =CGRectMake(0, 0, 200, 200);
//颜色
subLayer.backgroundColor =[UIColor greenColor].CGColor;
//位置
subLayer.position=CGPointMake(100, 100);
//锚点
subLayer.anchorPoint =CGPointMake(0 , 0);
//圆角
subLayer.cornerRadius =100;
//context内容
UIImage *image =[UIImage imageNamed:@"b"];
subLayer.contents =(__bridge id)(image.CGImage);
//边界剪裁
subLayer.masksToBounds =YES;