UIImagePickerController tutorial?

43,256

Solution 1

Well if you google something like:

UIImagePickerController and take snapshot put in json and send to server

Will be a bit hard. So, use this tutorial for the UIImagePickerController. By the way, the term for the search was:

UIImagePickerController Tutorial 2012

Solution 2

You should check this article from AppCoda Build a Simple iPhone Camera App, very clear and simple :)

Take photo using the native iOS Camera app

- (IBAction)takePhoto:(UIButton *)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self presentViewController:picker animated:YES completion:nil]; 
}

Read the captured photo (you have to implement UIImagePickerControllerDelegate

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    self.imageView.image = chosenImage;

    [picker dismissViewControllerAnimated:YES completion:nil];
}

Solution 3

I came across this code AQPhotoPicker. This is quite easy to use with only one call, you will get photo from camera or photoPicker

Share:
43,256
Admin
Author by

Admin

Updated on July 20, 2022

Comments

  • Admin
    Admin almost 2 years

    I am currently developing an application and I need to be able when pressing a button to open the camera and take a snapshot that I will attach to a .json file and send to my server. I am searching on google and StackOverflow for the last couple of hours but all the tutorials seem very old (08'-09') or not match my needs. I know that all the work is done with UIImagePickerController class but I would like to have a working example. Does anyone know a good tutorial to get started for something like this?

  • Rui Peres
    Rui Peres almost 12 years
    Sorry, it's a 2008 article. =/
  • Taryn
    Taryn over 10 years
    Thanks for posting your answer! Please note that you should post the essential parts of the answer here, on this site, or your post risks being deleted See the FAQ where it mentions answers that are 'barely more than a link'. You may still include the link if you wish, but only as a 'reference'. The answer should stand on its own without needing the link.
  • Abhishek Thapliyal
    Abhishek Thapliyal almost 8 years
    Hello i need help, i have two cases 1. A viewcontroller is pushed via navigation 2. A viewcontroller is presented viewcontroller is same in both case and in that i have imageview and picking image from photos(gallery). In 1st case i can see photo in image view after didfinshpicking BUT not in 2nd case. Can any one help me???
  • onmyway133
    onmyway133 almost 8 years
    @AbhishekThapliThapliyal Hi, that should be another question