UIImageView的layer的属相介绍,一些常用的加边框,加圆角放大,缩小等设置
2015-05-16 01:22
633 查看
UIImageView *personImage=[[UIImageViewalloc]
initWithFrame:CGRectMake(50,50,
70, 70)];
personImage.image=[UIImageimageNamed:@"20141118042246536"];
[self.viewaddSubview:personImage];
//1.设置阴影 因为shadowColor
是CGColorRef类型
所以要转换成CGColor类型
personImage.layer.shadowColor=[UIColoryellowColor].CGColor;
//2.阴影的偏移大小
personImage.layer.shadowOffset=CGSizeMake(10,10);
//3.不透明度
personImage.layer.shadowOpacity=0.5;
//4.设置圆角的大小
personImage.layer.cornerRadius=10;//设置圆角的半径为10
personImage.layer.masksToBounds=YES;//强制内部所有子层支持圆角效果,少了这个imageView没有圆角效果,设置之后没有阴影效果
//5.设置边框
personImage.layer.borderWidth=4;
personImage.layer.borderColor=[UIColorredColor].CGColor;
//6.设置旋转和缩放
personImage.layer.transform=CATransform3DMakeRotation(M_PI_4,0,
0, 1);//沿着Z轴旋转45°
personImage.layer.transform=CATransform3DMakeScale(0.5,1,
0);//缩小0.5倍
initWithFrame:CGRectMake(50,50,
70, 70)];
personImage.image=[UIImageimageNamed:@"20141118042246536"];
[self.viewaddSubview:personImage];
//1.设置阴影 因为shadowColor
是CGColorRef类型
所以要转换成CGColor类型
personImage.layer.shadowColor=[UIColoryellowColor].CGColor;
//2.阴影的偏移大小
personImage.layer.shadowOffset=CGSizeMake(10,10);
//3.不透明度
personImage.layer.shadowOpacity=0.5;
//4.设置圆角的大小
personImage.layer.cornerRadius=10;//设置圆角的半径为10
personImage.layer.masksToBounds=YES;//强制内部所有子层支持圆角效果,少了这个imageView没有圆角效果,设置之后没有阴影效果
//5.设置边框
personImage.layer.borderWidth=4;
personImage.layer.borderColor=[UIColorredColor].CGColor;
//6.设置旋转和缩放
personImage.layer.transform=CATransform3DMakeRotation(M_PI_4,0,
0, 1);//沿着Z轴旋转45°
personImage.layer.transform=CATransform3DMakeScale(0.5,1,
0);//缩小0.5倍
相关文章推荐
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- IOS UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- 给UIImageview 添加边框 或者设置成圆角-ios5貌似不能用?
- 给UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- UIView,UIButton,UIImageView等视图设置圆角,设置阴影,设置边框的方法
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- 给UIImageview 添加边框 或者设置成圆角
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- 给UIImageview 添加边框 或者设置成圆角
- 给UIImageview 添加边框 或者设置成圆角
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- 给UIImageview 添加边框或者设置成圆角