經過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;

}

相關文章
相關標籤/搜索