Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

markbarr

macrumors newbie
Original poster
Jan 10, 2016
1
0
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
 

grandM

macrumors 68000
Oct 14, 2013
1,520
302
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
picker.allowsEditing = NO
the imageView probably is not showing it because you are using UIImagePickerControllerEditedImage
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.