IOS中将颜色转换为image
2013-12-17 10:17
267 查看
- (UIImage *)createImageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
相关文章推荐
- iOS将颜色转换image方法
- iOS将颜色转换image方法
- iOS将颜色转换image方法
- Swift3 颜色转换成图片Image
- iOS image和string的相互转换
- iOS-swift-16进制颜色转换成RGB的例子
- iOS用图片设置背景颜色colorWithPatternImage
- iOS中将毫秒转换成时长
- iOS中将汉字转换成拼音的方法
- IOS开发中将中文转换为拼音首字母输出
- [iOS] NSString类型十六进制颜色转换
- WPF中将16进制颜色码转换成SolidColorBrush
- iOS颜色16进制值转换RGB
- ios 将view转换成image
- android 开发中将十六进制 颜色代码 转换为int类型数值
- iOS中将,NSArray转换成json数据
- IOS中十六进制的颜色转换为UIColor
- iOS中十六进制的颜色转换为UIColor
- iOS中(以#开头)十六进制的颜色转换为UIColor(RGB)
- iOS中将汉字转换成拼音的方法