18

Here I am developing an app using IOS 7 in which camera used to capture the image. but after capturing image it displaying Retake/Use Photo options. i want that after capturing image it directly go to next screen without showing default Retake?use Photo Options.I google out this Issue but I don't get proper solution. Please help me to solve this issue.

Thanks in advance.

Here is the code snippet that i am using in my project

enter image description here

-(void)StartCamera

{

if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])

{  

  UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"           message:@"Device has no camera" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];

    [myAlertView show];
}
else
{ 
    picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:YES completion:NULL];
}
}
aksh1t
  • 5,410
  • 1
  • 37
  • 55
Aabasaheb Deshpande
  • 399
  • 1
  • 3
  • 13

2 Answers2

10

The stock UIImagePickerControllerSourceTypeCamera provided by iOS has both these buttons.

One way to achieve what you want is to continue to use UIImagePickerViewController and set showsCameraControls to NO. Then, provide your own user interface using cameraOverlayView for your custom overlay view.

self.picker.showsCameraControls = NO;

self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;

self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;

Another way is to use AVFoundation to create your own camera view.

aksh1t
  • 5,410
  • 1
  • 37
  • 55
  • Cool! Also, check out this example from Apple : https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html – aksh1t May 28 '14 at 09:45
  • Here's the code with AVFoundation https://github.com/lteu/demo_AVFoundation . Hope it helps. – tong Sep 08 '19 at 17:18
-3
    let picker = UIImagePickerController()
        picker.delegate = self
        picker.allowsEditing = false
        picker.automaticallyAdjustsScrollViewInsets = true
        picker.sourceType = UIImagePickerControllerSourceType.camera

For both Camera as well as gallery.

If you're using any third party library for editing it will directly guide you to that library or dismiss the picker controller without giving preview.

Paul.V
  • 386
  • 1
  • 3
  • 13
  • 1
    allowEditing set to NO (false) for camera does not do this for me. I still get the retake/Use Photo controls – Chris Prince Oct 02 '18 at 19:24
  • @ChrisPrince I made some changes in my answer that helps you to resolve your issue. Thanks! – Paul.V Oct 03 '18 at 09:18
  • This answer is not correct. Setting the options as shown has no effect on the use/retake UI that iOS presents. That's not what the .allowsEditing option does. – Bill Patterson Aug 24 '20 at 13:02