iOS中将颜色转为图片
2017-02-07 18:17
246 查看
- (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 自定义导航栏背景图片和颜色
- ios开发之16进制颜色(html颜色值)字符串转为UIColor
- IOS中将颜色转换为image
- IOS关于从照相机获取图片的问题,初步探究通过摄像头实现颜色与形状识别机制==
- iOS开发笔记--使用blend改变图片颜色
- ios 自定义导航栏背景图片和颜色
- iOS开发中16进制颜色(html颜色值)字符串转为UIColor
- iOS中使用blend改变图片颜色
- iOS中使用blend改变图片颜色
- iOS设置UINavigationBar的背景颜色或背景图片
- ios开发之16进制颜色(html颜色值)字符串转为UIColor
- iOS中使用blend改变图片颜色
- iOS中使用blend改变图片颜色
- iOS小技巧:如何给UIPageControl更换图片和颜色
- iOS开发中16进制颜色(html颜色值)字符串转为UIColor
- iOS中使用blend改变图片颜色 转自onevcat
- ios 更改全局UINavigationBar的背景图片以及通知栏颜色
- 十六进制的颜色值直接转为ios可用的UIColor
- iOS 获取图片某一点的颜色对象(UIColor*)。