3

I'm developing an app that needs to take two pictures in a row. I'm currently using the iPhone camera but :

  • I would like to NOT have the cancel button on the bottom left
  • I would like to NOT have the preview of my picture (with the blue button "use").

What should I do ? Should I make my own camera ? I couldn't find an easy tutorial for a custom camera with only a "take picture" button...

nax_
  • 469
  • 6
  • 16

2 Answers2

7

Create a UIImagePickerController from code, adjust its properties, add an overlay onto it, and with you controller, control whatever you want on that overlay: custom controls, overlaying images, etc...

That gives something like this :

self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;

// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;

[self presentModalViewController:self.picker animated:NO];

OverlayViewController is the controller that you must write to control everything you add onto the overlay.

pickerReference is a property you can keep to send orders to the camera. For example, you could call the following from an IBAction coming from a UIButton placed onto the overlay:

[self.pickerReference takePicture];
Mustafa
  • 20,504
  • 42
  • 146
  • 209
Oliver
  • 23,072
  • 33
  • 138
  • 230
2

The easiest way to do it is to use UIImagePickerController with showsCameraControls set to NO and a custom view set in cameraOverlayView; this view can have whatever buttons you need on it. When touched, the button should call takePicture on the image picker, and when you're done just use dismissModalViewControllerAnimated: to dismiss the picker.

Anomie
  • 92,546
  • 13
  • 126
  • 145