如何从iPhone中的应用程序文档文件夹中保存设备图像库文件夹中的图像? [英] How to save image in my device image library folder from my app document folder in iPhone?
问题描述
我从网络服务收到一些图片,并将它们存储到我的应用文档文件夹中。现在我在iPhone设备中使用我的应用名称创建了一个图像库。现在。我想在此图像库中显示图像。
I am receiving some image from web-service and store them into my app document folder. Now I have create an image library with my app name in iPhone device. Now. I want to show the images in this image library.
为了保存系统图像,我使用此代码 -
For saving the system image I am using this code -
[self.library1 addAssetURL:url toAlbum:@"My_App_Name" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
但是当我获取文档文件夹图像的网址时,这不起作用。帮助我或提供任何解决方案。
but this is not work when I get the url of my document folder image. Help me out or gave any solution.
推荐答案
iOS5 包括<$ c $中的新API c> AssetsLibrary 框架,让您有机会在用户的照片库中管理应用程序自己的相册。
iOS5 includes new API in the AssetsLibrary
framework, which afford you the chance to manage your app’s own photo album inside the user’s photo library.
我觉得这很容易peasy。你的应用应该创建一个 UIImage
,只需要将它传递给下面的方法以及专辑名称和要处理的块。
I think it is easy peasy. Your app should create an UIImage
and will just need to pass it to the below method along with the album name and a block to handle.
-(void)saveImage:(UIImage*)image
toAlbum:(NSString*)albumName
withCompletionBlock:(SaveImageCompletion)completionBlock;
您可以看到更多详情 here
You can see more details here
这篇关于如何从iPhone中的应用程序文档文件夹中保存设备图像库文件夹中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!