文件存储
2016-10-25 15:28
162 查看
<span style="font-size:24px;">UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
// 保存图片到指定的路径
NSData *data = UIImagePNGRepresentation(newImage);
[data writeToFile:@"/Users/userName/Desktop/myShaoNv.png" atomically:YES];
</span>
[objc]
view plain
copy
print?
<span style="font-size:24px;"> // 保存image 到相册中
UIImageWriteToSavedPhotosAlbum(newImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
// 保存到相册的代理方法, 判断保存的结果是否成功还是失败的信息
// 实现imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(voidvoid *)contextInfo
{
NSString *message = @"保存照片";
if (!error) {
message = @"保存成功";
} else
{
message = [error description];
}
NSLog(@"message is %@", message);
}
</span>
// 保存图片到指定的路径
NSData *data = UIImagePNGRepresentation(newImage);
[data writeToFile:@"/Users/userName/Desktop/myShaoNv.png" atomically:YES];
</span>
[objc]
view plain
copy
print?
<span style="font-size:24px;"> // 保存image 到相册中
UIImageWriteToSavedPhotosAlbum(newImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
// 保存到相册的代理方法, 判断保存的结果是否成功还是失败的信息
// 实现imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(voidvoid *)contextInfo
{
NSString *message = @"保存照片";
if (!error) {
message = @"保存成功";
} else
{
message = [error description];
}
NSLog(@"message is %@", message);
}
</span>
相关文章推荐
- 项目迭代开发手记--文件分割存储用例的实现过程(2)
- 创建存储过程的XML注释文件
- 在ASP.NET程序中存储和调用word文件(转载)
- ASP.NET程序中存储和调用word文件
- 读取存储在MsSql下的文件,配合使用DataGrid的模板列。
- Oracle9i数据库存储和读取clob文件(PL/SQL脚本)
- 在ASP.NET程序中存储和调用word文件(转载)
- 将表/查询存储为标准的XML文件
- 实用-实现文件存储的JS函数
- 一个应用二叉搜索树实现的字典,并存储结构于文件中
- [zz]如何在Java应用中将图像存储到图像文件中?
- 将DataGrid中CheckBox被选择的行存储到EXcl文件中
- 文件应该存储在手机的什么地方?
- 文件分割存储用例的实现一
- 数据库中存储与读取文件
- T-SQL 存储过程创建 PDF 格式文件(报表)
- 项目迭代开发手记--文件分割存储用例的实现过程(3)
- 将 图片 文件存储到 Oracle 的存储过程
- 如何往数据库(Oracle)里存储图片和文件?
- 各种类型文件在SQL Server中存储的解决方案