首先不要忘記,必須導入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];//值越大,角度越圓