/**
- 根據(jù)顏色生成一張圖片
- @param color 顏色
- @param size 圖片大小
- @return 圖片
*/
-
(UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
{
if (color) {
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,color.CGColor);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();return img;}
return nil;
}