My problem; Hide the default camera controls and overlay it with my my own. This is made with the property cameraOverlayView. I also was having problem triggering the takePicture method.

- 5,753
- 72
- 57
- 129

- 88
- 2
- 9
-
Just go ahead and try something. Come back here if you run into concrete problems. – mvds Feb 06 '12 at 11:07
-
http://jcuz.wordpress.com/2010/02/17/pickerfocus/ – Sharme Feb 06 '12 at 11:07
-
possible duplicate of [UIImagePickerController: Custom camera overlay sitting on top of default controls?](http://stackoverflow.com/questions/5251336/uiimagepickercontroller-custom-camera-overlay-sitting-on-top-of-default-control) – Juicy Scripter Feb 06 '12 at 11:11
-
This is actually the tutorial that my project is based on. But it doesn't mention anything about the takepicture method... Thanks though! – user921509 Feb 07 '12 at 01:41
1 Answers
(Question solved in the comments and in the edits. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
Here is what came to be the solution:
I have two UIViewController. The main ViewController and the CustomOverlay (for the camera controls).
I the ViewController I declare the source type and the overlay for may camera control like this:
- (void)viewDidLoad
{
// notification from the CustomOverlay Controller that triggers the eTakePicture method
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eTakePicture:) name:@"eTakePicture" object:nil];
daysBtn.delegate = self;
daysBtn.hidden = YES;
picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
picker.showsCameraControls = NO;
picker.navigationBarHidden = YES;
picker.wantsFullScreenLayout = YES;
picker.delegate = self;
overlay = [[CustomOverlay alloc] initWithNibName:@"CustomOverlay" bundle:nil];
// Overlay for the camera controls, note the "= overlay.view", the ".view" was important
// because the overlay is a new UIViewcontroller (with xib) so you have to call the
// view. Most tutorials that I saw were based on UIView so only "= overlay" worked.
picker.cameraOverlayView = overlay.view;
[self presentModalViewController:picker animated:NO];
[super viewDidLoad];
}
Now on the CustomOverlay, which is a UIViewController I have the take picture button and want this button to trigger a method in the main ViewController:
- (IBAction)shoot:(id)control {
[[NSNotificationCenter defaultCenter] postNotificationName:@"eTakePicture" object:self];
}
And back to the main ViewController:
-(void)eTakePicture:(NSNotification *)notification
{
[picker takePicture];
}
All the code above will change a little more once I review it, specially the first block where I have to have a condition to check if cameraSourceType is available.
Hope that helps somebody out there. Any question, just ask.

- 1
- 1

- 5,753
- 72
- 57
- 129