1. 画圆角
(1)传统的圆角设置方式 imageView.clipsToBounds = YES;
imageView.layer.cornerRadius = 4;
(2)使用UIBezierPath(此处self指的是View)
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(corner, corner)];
CAShapeLayer * layer = [CAShapeLayer new];
layer.frame = self.bounds;
layer.path = path.CGPath;
self.layer.mask = layer;
2.设置圆角之后我们会发现再设置阴影时无效果,此时我们需要创建一个view把imageview加载在view上,设置view的shadow
imageView.layer.shadowColor = [UIColor blackColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(5, 5);//设置阴影的便宜位置
imageView.layer.shadowOpacity = 0.8;
imageView.layer.shadowRadius = 5;