标签:
self.myView=[[UIView alloc]initWithFrame:CGRectMake(50, 50, 200, 200)];
self.myView.backgroundColor=[UIColor redColor];
[self.view addSubview:self.myView];
//加一张图片
UIImageView *imv=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"3.png"]];
imv.frame=self.myView.bounds;
[self.myView addSubview:imv];
//设置圆角
self.myView.layer.cornerRadius=25;
//描边粗细
self.myView.layer.borderWidth=20;
//描边颜色(需要装换类型 后面加.CGcolor)
self.myView.layer.borderColor=[UIColor cyanColor].CGColor;
//阴影颜色
self.myView.layer.shadowColor=[UIColor orangeColor].CGColor;
//阴影偏移
self.myView.layer.shadowOffset=CGSizeMake(10, 10);
//阴影透明度(是必须设置的)
self.myView.layer.shadowOpacity=0.5;
//模糊程度(阴影的模糊程度)
self.myView.layer.shadowRadius=10;
//设置锚点
self.myView.layer.anchorPoint=CGPointMake(0.5, 0.5);
//打印position
NSLog(@"position:%@",NSStringFromCGPoint(self.myView.layer.position));
//打印锚点
NSLog(@"锚点:%@",NSStringFromCGPoint(self.myView.layer.anchorPoint));
标签:
原文地址:http://www.cnblogs.com/-ios/p/4672944.html