iOS 通过颜色来生成一个纯色图片
2015-04-09 14:26
886 查看
//通过颜色来生成一个纯色图片
- (UIImage *)buttonImageFromColor:(UIColor *)color{
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
- (UIImage *)buttonImageFromColor:(UIColor *)color{
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
相关文章推荐
- 【代码笔记】iOS-通过颜色来生成一个纯色图片
- 【代码笔记】iOS-通过颜色来生成一个纯色图片
- iOS 通过颜色来生成一个纯色图片
- 通过颜色来生成一个纯色图片
- 通过颜色来生成一个纯色图片
- ios 通过一个View生成一个图片
- iOS开发小方法:根据UIColor一个颜色生成一张图片
- IOS关于从照相机获取图片的问题,初步探究通过摄像头实现颜色与形状识别机制==
- IOS中通过变成生成图片
- 微软做了一个“绘画机器人”,可以通过文字生成图片
- IOS Quartz2D 通过UIColor生成图片
- iOS开发之UIColor类拓展,可通过上百种颜色名字生成颜色 可通过十六进制生成颜色
- 通过freemarker生成一个word,解决生成的word用wps打开有问题的问题,解决出word时中文文件名乱码问题,解决打开出word时打开的word出现问题的问题,出图片,解决动态列表
- iOS 中由颜色值生成图片
- IOS Quartz2D 通过UIColor生成图片
- 通过颜色生成图片,直接上代码
- IOS 小技能 通过颜色制作图片
- iOS一个应用有多个颜色主题时,用到图片的地方如何处理
- ios颜色生成图片的方法
- ios设置导航栏透明方法:使用只有一个像素点的透明图片,通过以下代码即可