Search code examples
iosobjective-cios-camera

iPhone camera controls are misaligned


For some reason my camera controls are misaligned and are displaying cut off at the top of the screen. Below is the code that I've implemented to use the camera, is there anything that could fix this?

- (void)takePhoto {
     UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    } else {
        picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    }
    [MAINVIEWCONTROLLER presentViewController:picker animated:YES completion:nil];

}

enter image description here


Solution

  • check wantsFullScreenLayout and set it accordingly.

    If you want full screen, you will also need to hide the status bar using setStatusBarHidden:withAnimation: