[iOS]純色画像を描く
526 ワード
//
+ (UIImage *)lj_imageWithColor:(UIColor *)color rect:(CGRect)rect {
//
UIGraphicsBeginImageContext(rect.size);
//
CGContextRef context = UIGraphicsGetCurrentContext();
// color
CGContextSetFillColorWithColor(context, [color CGColor]);
//
CGContextFillRect(context, rect);
//
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
//
UIGraphicsEndImageContext();
return image;
}