Corona中文站

强大、易学的跨平台(iOS/Android)开发框架。QQ群1:74390406(满) 群2:221929599

导航

iphone如何将图片保存到相册中
将图片保存在一个数组中,通过UIImageWriteToSavedPhotosAlbum进行保存
//in the .h file put:
NSMutableArray
*myPhotoArray;
///then in the .m
-
(void) viewDidLoad { myPhotoArray =
[[NSMutableArray alloc]init];
}
//However Your getting images
-
(void) someOtherMethod {
UIImage
*someImage =
[your prefered method of using
this];
[myPhotoArray addObject:someImage];
}
-(void) saveMePlease {
//Loop through the array here
for
(int i=0:i<[myPhotoArray count]:i++){
NSString
*file =
[myPhotoArray objectAtIndex:i];
NSString
*path =
[get the path of the image like you would in DOCS FOLDER or whatever];
NSString
*imagePath =
[path stringByAppendingString:file];
UIImage
*image =
[[[UIImage alloc] initWithContentsOfFile:imagePath]autorelease];
//Now it will do this for each photo in the array
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
}
<< iphone从一个图片截取部分区域生成新的小图iphone从web服务器获取图片并显示在视图上 >>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最近发表

Powered By Z-Blog 1.8 Walle Build 100427 Copyright 2011-2015 BuildApp.Net. All Rights Reserved.