yosifz8
yosifz8

Reputation: 561

taking photo and saving it in to photo album

i use this code for taking a photo:

-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

if((UIButton *) sender == choosePhotoBtn) {
    picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}

[self presentModalViewController:picker animated:YES];

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}

and i want to know how i can save this photo that i take to the photo album.

Upvotes: 0

Views: 333

Answers (1)

Anne
Anne

Reputation: 27073

Checkout the UIKit Function Reference, use:

UIImageWriteToSavedPhotosAlbum()

Usage:

UIImageWriteToSavedPhotosAlbum(theImage, nil, nil, nil);

Upvotes: 1

Related Questions