iOS开发之使用颜色生成图片

-(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 *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}

你可能感兴趣的:(iOS开发,---,随笔篇,ios,ios开发,图片,uiimage,color)