I created a custom overlay for the camera, using the following code:
- (void) showCamera {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
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.overlay = [[CameraOverlayViewController alloc] init];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;
[self presentViewController:self.picker animated:NO completion:nil];
}
It works fine on iphone 4 (as the camera covers the entire screen), but on iphone 5 the camera is on the top of the screen, leaving black square at the bottom. As I cannot change the camera size, at least I want to center it in the middle of the screen, and then add UIViews as margins (quite similar to apple's Camera Roll app, where the camera is not on the top of the screen, and there are controls both above and below it).
Can someone please advise how can I control the camera frame in such scenario? Also, as the margins will be only for nicer visualisation, I may not want to show them on iphone 4 or ipad screen.
Thanks in advance !