+ (UIImage *)imageWithUIColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 55.f, 1.f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
iOS——颜色转图片
最新推荐文章于 2024-10-07 19:01:55 发布