代码生成单色图片
作者:
萝BAIBAI | 来源:发表于
2016-03-07 22:55 被阅读41次- (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size {
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
本文标题:代码生成单色图片
本文链接:https://www.haomeiwen.com/subject/xaqzkttx.html
网友评论