self.view.backgroundColor = [UIColor redColor];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];
//UIRectCornerAllCorners 可改为四个角
UIRectCornerTopLeft ,
UIRectCornerTopRight ,
UIRectCornerBottomLeft ,
UIRectCornerBottomRight ,
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(imageView.frame.size.height / 2.0, imageView.frame.size.height / 2.0)];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = bezierPath.CGPath;
imageView.layer.mask = shapeLayer;