通过颜色生成图片
作者:
伯牙呀 | 来源:发表于
2018-06-04 15:51 被阅读25次+ (UIImage *)createImageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
本文标题:通过颜色生成图片
本文链接:https://www.haomeiwen.com/subject/qdlysftx.html
网友评论