美文网首页
IOS 一个将颜色转化为UIImage的函数

IOS 一个将颜色转化为UIImage的函数

作者: 0诛仙0 | 来源:发表于2016-07-15 10:11 被阅读54次

- (UIImage *)imageWithColor:(UIColor *)color {

CGRect rect = CGRectMake(0, 0, 1, 1);

UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);

[color setFill];

UIRectFill(rect);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

相关文章

网友评论

      本文标题:IOS 一个将颜色转化为UIImage的函数

      本文链接:https://www.haomeiwen.com/subject/zkqsjttx.html