iOS-UIImage 互转 UIColor
2015-11-23 17:12
429 查看
//UIColor 转UIImage - (UIImage*) createImageWithColor: (UIColor*) color { CGRect rect=CGRectMake(0, 0, 1, 1); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *senderImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return senderImage; } //UIImage转UIColor [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];
相关文章推荐
- 二十六天( UI开始)
- iOS 【UIKit-UIPickerView】
- mrc下自定义UITableViewCell写法
- datagrid参数queryParams--easyUI
- EASYUI datagrid批量修改与提交
- Kibana User Guide [4.2] » Settings » Setting Advanced Options
- hdu5568 sequence2(dp + 高精度)
- UI复习
- [Qt]新增UAC功能之requireAdministrator
- iOS 9人机界面指南(一):UI设计基础
- IOS上 关于状态栏的相关设置(UIStatusBar)(转载自shede333博客)
- UITextFieldDelegate和tap事件
- UIToolBar
- iOS学习笔记--03 UITableView相关
- UITextField *textfield常用的取消键盘方法
- dialect does not support sequences
- UITextField
- java+uiautomator 打包运行
- 做一个Active To
- maven web项目build失败