Univer
Univer

Reputation: 325

iphone sdk how to get complete images from photo library?

Hi i want the images what ever saved in photo library.Using assert library can i get complete images stored in photo library.If yes,can anyone please tell me the code for that.Thanks in advance.

Upvotes: 1

Views: 1715

Answers (1)

Paul Cezanne
Paul Cezanne

Reputation: 8741

Super easy to do!

UIImagePickerController *imagePicker = [[UIImagePickerController     alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

[imagePicker setDelegate:self];
[self presentModalViewController:imagePicker animated:YES];

and

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{
    [picker dismissModalViewControllerAnimated:YES];
    [picker release];

    // Edited image works great (if you allowed editing)
    //myUIImageView.image = [info objectForKey:UIImagePickerControllerEditedImage];
    // AND the original image works great
    //myUIImageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
    // AND do whatever you want with it, (NSDictionary *)info is fine now
    //UIImage *myImage = [info objectForKey:UIImagePickerControllerEditedImage];

    UIImage *image =  [info objectForKey:UIImagePickerControllerOriginalImage];

    [customImageView setImage:image]; 

    customImageView.contentMode = UIViewContentModeScaleAspectFill;
}

got this code from stackoverflow, didn't save the URL, sorry.

Upvotes: 3

Related Questions