iOS 图片切圆角的另外两种方式

 1:

  UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:imageView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:imageView.bounds.size];

    CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init];

    maskLayer.frame = imageView.bounds;

    maskLayer.path = maskPath.CGPath;

    imageView.layer.mask = maskLayer;

2:

    UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 1.0);

    [[UIBezierPath bezierPathWithRoundedRect:imageView.bounds cornerRadius:imageView.frame.size.width]addClip];

    [imageView drawRect:imageView.bounds];

    

    imageView.image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

原文地址:https://www.cnblogs.com/LynnAIQ/p/5938952.html