iOS 利用颜色值生产图片

+(UIImage *)hh_imageWithColor:(UIColor *)color Size:(CGSize)size

{

CGRect rect = CGRectMake(0.0, 0.0, size.width, size.height);

UIGraphicsBeginImageContext(size);

CGContextRef ref = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(ref, [color CGColor]);

CGContextFillRect(ref, rect);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

你可能感兴趣的:(iOS 利用颜色值生产图片)