NSDate和UIImage 数据相互转化_数据库中只能存二进制数据
2015-11-18 16:55
597 查看
NSData 与 UIImage
NSData->UIImage
UIImage *aimage = [UIImage imageWithData: imageData];
//例:从本地文件沙盒中取图片并转换为NSData
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *name = [NSString stringWithFormat:@”ceshi.png”];
NSString *finalPath = [path stringByAppendingPathComponent:name];
NSData *imageData = [NSData dataWithContentsOfFile: finalPath];
UIImage *aimage = [UIImage imageWithData: imageData];
UIImage-> NSData
NSData *imageData = UIImagePNGRepresentation(aimae);
NSData->UIImage
UIImage *aimage = [UIImage imageWithData: imageData];
//例:从本地文件沙盒中取图片并转换为NSData
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *name = [NSString stringWithFormat:@”ceshi.png”];
NSString *finalPath = [path stringByAppendingPathComponent:name];
NSData *imageData = [NSData dataWithContentsOfFile: finalPath];
UIImage *aimage = [UIImage imageWithData: imageData];
UIImage-> NSData
NSData *imageData = UIImagePNGRepresentation(aimae);
相关文章推荐
- 近期UI设计经验回顾
- iOS通过URL构建UIImage
- easyui只选择年份月份的插件---SimpleCanleder
- 【FAQ】oclint-xcodebuild error:cannot find original pch source file?
- Kibana User Guide [4.2] » Getting Kibana Up and Running
- 本文来介绍UITextField控件的使用!
- cloudera manager5删除uuid,主机找不到集群
- IOS UITabBarViewController 和UINavigationController 结合使用
- Jquerry应用
- coderforce 545B. Equidistant String
- 表产生sequence功能,测试并发
- Android酷炫实用的开源框架(UI框架)
- Retrieving the COM class factory for component with CLSID {000209FF-XXX} failed due to the following error: 80070005 Access is denied.
- relation "hibernate_sequence" does not exist解决
- Git GUI 学习笔记
- 【idea自动生成serialVersionUID】
- Ant中build.xml详细部署
- 安装confluence
- 解决UINavigationBar导航栏 和 tabBar 菜单栏上面平铺视图
- gcc 编译错误 Value too large for defined data type