objective-cuiimagepickercontrollercamera-overlay

Reposition Camera View


I have created and OverlayView for my UIImagePickerController. Is there a way to reposition where the viewer shows up? Currently the viewer is pushed all of the way to one side of the device with a black box filling the remaining portion of the screen.

- (IBAction)presentCameraView:(id)sender {

_picker = [[UIImagePickerController alloc] init];
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;

// Set flag to allow the alert to be shown
_showAlert = YES;
_endAlerts = NO;

_overlay = [[[NSBundle mainBundle] loadNibNamed:@"CameraOverlay" owner:self options:nil] objectAtIndex:0];
_picker.delegate = self;
_picker.wantsFullScreenLayout = YES;
_picker.allowsEditing = NO;
_picker.cameraOverlayView = _overlay;
_picker.showsCameraControls = NO;
[self presentViewController:_picker animated:YES completion:NULL];
}

enter image description here

enter image description here


Solution

  • So, after a lot of looking I finally came across some stuff that allowed me to reposition the camera view as well as change the size of it.

    CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 71.0); 
    //This slots the preview exactly in the middle of the screen by moving it down 71 points
    
    CGAffineTransform scale = CGAffineTransformScale(translate, 0.8888889, 1);
    //This scales the view to the size that you want it.
    
    _picker.cameraViewTransform = scale;