经过UIColor转换为UIImage

+ (UIImage *)createImageWithColor:(UIColor *)colorspa

{it

    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);class

    UIGraphicsBeginImageContext(rect.size);co

    CGContextRef context = UIGraphicsGetCurrentContext();return

    CGContextSetFillColorWithColor(context, [color CGColor]);context

    CGContextFillRect(context, rect);

    

    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return theImage;

}

相关文章
相关标签/搜索