11

i will like to add a custom overlay on the UIImagepickerview with some custom buttons.

will appreciated if anyone could show me a link or 2 to the tutorial.

thanks

Desmond
  • 5,001
  • 14
  • 56
  • 115

2 Answers2

16

Here is a PhotoPicker sample code project:

https://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010196

The gist is to make your own class with a .xib file with a custom toolbar, and then add that as a custom overlay. Make sure that you set your UIImagePickerController's showCameraControls property to NO.

Assuming that you have created a OverlayViewController class that is a UIImagePickerControllerDelegate and has a UIImagePickerController picker:

self.picker.showsCameraControls = NO;

In addition (for iPhone), you will find that there is a difference in aspect ratio between the live camera picture and the iPhone screen size, which will give you a bar at the bottom of your screen. This can be fixed by doing a translation and scale:

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 25.0);
self.picker.cameraViewTransform = CGAffineTransformScale(translate, 480.0/430.0, 480.0/430.0);
self.picker.cameraOverlayView = self.view;
Arnaud
  • 7,259
  • 10
  • 50
  • 71
g_low
  • 2,435
  • 19
  • 23
  • I have one small issue with the custom camera live screen. I've created a custom camera and the live screen loads fine in the portrait mode. But when i change it to the landscape mode, i get this error in the console "CGAffineTransformInvert: singular matrix". I tried using autoresizing mask for the orientation change of the live screen, but it isn't helping. – The X-Coder Mar 20 '13 at 12:51
3

Apple has a good tutorial, how to customize uiimagepickerview. His name is PhotoPicker

Igor
  • 4,235
  • 3
  • 34
  • 32