2022-06-13(图片切割圆角)

///图片切割圆角
- (UIImage *)clipImageCornerRadius:(UIImage *)image{
    UIGraphicsBeginImageContextWithOptions(image.size, NO, 0);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
    CGContextAddEllipseInRect(ctx, rect);
    CGContextClip(ctx);
    [image drawInRect:rect];
    UIImage *imageNew = UIGraphicsGetImageFromCurrentImageContext();
    return imageNew;
}

https://blog.csdn.net/smaller_coder/article/details/79363616

你可能感兴趣的:(2022-06-13(图片切割圆角))