0

In my app, I need to have a Camera Overlay to help the user line up the picture correctly for it's intended use. Further, I need to have the Editing interface to let them fine tune the zoom and alignment with this "guide". I have gotten the Camera overlay to work with the default Camera Controls (the editing pane won't even show unless you use the default controls) , however now on the editing screen, I cannot zoom/pan. The touch events seem to occur on the overlay, and not the editing screen. I know/knew this was a potential problem, and have implemented the fix mentioned here

This allows focusing on the camera screen itself, you can see the touches are being passed through/ignored in the overlay, but on the editing screen this is still not working. I have also tried some of the hittest code found here

That solution gives me an error every time that No visible @interface for 'UIViewController' declares the selector 'hitTest:withEvent:' on the super line.

I have also tried all kinds of settings playing with the userInteractionEnabled property

Here is the code I am using to do the overlay:

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

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

self.picker.cameraOverlayView = self.overlay.view;
[self.picker.cameraOverlayView setUserInteractionEnabled:YES];
//[self.picker.cameraOverlayView setUserInteractionEnabled:FALSE];
self.picker.delegate = self.overlay;

// [self performSelector:@selector(moveOverlayViewToSublayer:) withObject:self.picker afterDelay:0.1f];

[self presentModalViewController:self.picker animated:NO];
Community
  • 1
  • 1
TomC
  • 139
  • 2
  • 12

1 Answers1

0

I had trouble getting a custom overlay working using a xib file and ended up just creating the overlay view in code.

There are examples of how to achieve this around the Net:

http://www.musicalgeometry.com/?p=821

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

dvingo
  • 73
  • 5