当前位置: 代码迷 >> Iphone >> iPhone高速参考:将图片保存到照相册中
  详细解决方案

iPhone高速参考:将图片保存到照相册中

热度:77   发布时间:2016-04-25 06:28:19.0
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 herefor (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);? ? ? ? }}

  相关解决方案