通过颜色绘制图片UIImage

+ (UIImage *)clearImageView {
    UIColor *color=[UIColor clearColor];
    CGRect rect =CGRectMake(0,0,64,64);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context =UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
    return image;
}
原文地址:https://www.cnblogs.com/cchHers/p/12297602.html