Alex Rivera | Logout

How to save picture to iPhone photo library?

Asked 2008-10-07T15:08:36.260
199

What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone?

Edit
Report

1 Answer

10

Just pass the images from an array to it like so

-(void) saveMePlease {

//Loop through the array here
for (int i=0:i<[arrayOfPhotos count]:i++){
         NSString *file = [arrayOfPhotos 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);
        }
}

Sorry for typo's kinda just did this on the fly but you get the point

answered 2010-03-30T02:16:53.373

Your Answer