IOS方形头像如何变成圆形
方法一:直接使用UIView对应图层的cornerRadius
self.layer.cornerRadius = CGRectGetWidth(self.bounds)/2.f;
self.clipsToBounds = YES;
方法二:使用图层遮罩
CAShapeLayer* mask = [CAShapeLayer layer];
CGFloat width = self.frame.size.width;
UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2,width/2) radius:width /2 startAngle:0 endAngle:2*M_PI clockwise:YES];
mask.path = path.CGPath;
self.layer.mask = mask;