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

猜你喜欢

转载自www.cnblogs.com/cchHers/p/12297602.html