直接使用UIColor生成所需要才纯色UIImage
/**
* 将UIColor变换为UIImage
*
**/
+ (UIImage *)createImageWithColor:(UIColor *)color
{
//设置长宽
CGRect rect = CGRectMake(0.0f, 0.0f, 5.0f, 5.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultImage;
}
生成圆角纯色UIImage的方法