将color转为UIImage
2016-05-11 13:40
423 查看
//将color转为UIImage - (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; }
相关文章推荐
- UIImage初始化的区别两种方法介绍(面试常见)
- iOS应用开发中对UIImage进行截取和缩放的方法详解
- IOS高级教程1:处理1000张图片的内存优化
- 获取UIImage中的图像数据
- UIImage的一个实例函数stretchableImageWithLeftCapWidth
- 【无线互联】基于ios系统的图片(滤镜)编辑
- UIImageView的使用
- iOS实现头像选取(照相或者图片库)、大小等比缩放、生成圆形头像
- iOS- UIImageView/手势识别
- MBProgressHUD的基本使用
- IOS SWIFT 设置图片圆形
- UIImageView 加载高清大图时内存管理
- UIColor的RGB转16进制和转UIImage
- 图片裁剪工具类
- IOS 获取所有图片工具类
- IOS Multipage(多页面)程序开发,UITabBarController
- ios 获取当前屏幕快照
- UIImage 切圆
- 关于UIimage的一些注释
- 在UIView中与UIViewController中画图