通过颜色绘制图片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;
}

 

posted @ 2020-02-12 00:51  码出境界  阅读(202)  评论(0编辑  收藏  举报