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

2022-06-13  本文已影响0人  ImmortalSummer
///图片切割圆角
- (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

上一篇 下一篇

猜你喜欢

热点阅读