Illep
Illep

Reputation: 16859

Take an image and save it on iPhone

I am looking for a tutorial where i can take a picture using my iPhone and save it on the phone. I googled this but was not able to find any tutorial or sample code to begin with. Can someone please help me by pointing out a tutorial or sample code?

Upvotes: 0

Views: 253

Answers (3)

Rahul Chavan
Rahul Chavan

Reputation: 510

Code for the Taking Image

UIPicker.sourceType=UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:UIPicker animated:YES];

Successful capture of image

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage  *)image editingInfo:(NSDictionary *)editingInfo {


    //code to save image in gallary
    UIImageWriteToSavedPhotosAlbum(receivedImage, nil,nil, nil);

     //close the picker
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];

}

Failure in capture of image

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
     //close the picker
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

Upvotes: 1

beryllium
beryllium

Reputation: 29767

For getting image by camera see this articles:

Camera Programming Topics for iOS

UIImagePickerController Class Reference

Upvotes: 2

Related Questions