+ (UIImage *)createImageWithColor:(UIColor *)color andSize:(CGSize)size
{
CGRect rect=CGRectMake(0.0f, 0.0f, size.width, size.height);
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
把UIColor(纯色值)对象转化成UIImage对象
最新推荐文章于 2020-06-28 16:23:21 发布