UImageview加边框 加阴影
2012-03-22
UIImageView *imgvPhoto = [UIImageView alloc] init];
//添加边框
CALayer *layer = [_imgvPhoto layer];
layer.borderColor = [[UIColor whiteColor] CGColor];
layer.borderWidth = 5.0f;
//添加四个边阴影
_imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
_imgvPhoto.layer.shadowOffset = CGSizeMake(0, 0);
_imgvPhoto.layer.shadowOpacity = 0.5;
_imgvPhoto.layer.shadowRadius = 10.0;
//添加两个边阴影
_imgvPhoto.layer.shadowColor = [UIColor blackColor].CGColor;
_imgvPhoto.layer.shadowOffset = CGSizeMake(4, 4);
_imgvPhoto.layer.shadowOpacity = 0.5;
_imgvPhoto.layer.shadowRadius = 2.0;
//设置layer
CALayer *layer=[backView layer];
//是否设置边框以及是否可见
[layer setMasksToBounds:YES];
//设置边框圆角的弧度
[layer setCornerRadius:10.0];
//设置边框线的宽
[layer setBorderWidth:1];
//设置边框线的颜色
[layer setBorderColor:[[UIColor blackColor] CGColor]];