首先不要忘记,必须导入IOS的framework:
#import <QuartzCore/QuartzCore.h>
这样才能启动UIImageView中layer的一个category
图片阴影:
[[imageView layer] setShadowOffset:CGSizeMake(5, 5)]; // 阴影的范围
[[imageView layer] setShadowRadius:2]; // 阴影扩散的范围控制
[[imageView layer] setShadowOpacity:1]; // 阴影透明度
[[imageView layer] setShadowColor:[UIColor brownColor].CGColor]; // 阴影的颜色
图片圆角
CALayer *lay = faceImg.layer;//获取ImageView的层
[lay setMasksToBounds:YES];
[lay setCornerRadius:3.0];//值越大,角度越圆