take photo without editing

Discussion in 'iOS Programming' started by markbarr, Jan 10, 2016.

  1. markbarr macrumors newbie

    Joined:
    Jan 10, 2016
    #1
    Guys

    The following Code is what I used to take a photo display it in an imageview and save it

    Code:
      
    
    //     BUTTON CODE
       - (IBAction)takePhoto:(id)sender {
         UIImagePickerController *picker = [[UIImagePickerController alloc] init];
         picker.delegate = self;
    
    
         picker.allowsEditing = YES;
    
    
         picker.sourceType = UIImagePickerControllerSourceTypeCamera;
         [self presentViewController:picker animated:YES completion:NULL];
         }
        //   SAVE PHOTO
       - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
        UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
        self.imageView.image = chosenImage;
        [picker dismissViewControllerAnimated:YES completion:NULL];
        if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
            UIImageWriteToSavedPhotosAlbum(chosenImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
        
         }
    the problem is when i take the photo the square editing box comes up and it only saves the square part but it displays it fine in the imageview.

    Problem is if i remove the allows editing or change it to NO it saves the full photo fine but it doesnt display it in the imageview.

    I want to be able to take a full size photo and save it

    any ideas where I am going wrong?

    Any help appreciated

    Mark
     
  2. mjohnson1212 macrumors member

    Joined:
    Nov 15, 2007
    #2
    You can use UIImagePickerControllerOriginalImage to get the original image from info.
     
  3. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #3
    picker.allowsEditing = NO
    the imageView probably is not showing it because you are using UIImagePickerControllerEditedImage
     

Share This Page