Search code examples
iosuinavigationcontrolleruinavigationbaruiimagepickercontroller

UINavigationBar disappears after UIImagePickerController is popped


I have UIViewController that is embedded in a UITabBarController. On my PhotoViewController the user can select to add a photo and the UIImagePickerController is called. After the user selects the photo and the view is popped, the Navigation Bar disappears.

The Navigation bar is shown.

Start

This is the UIImagePickerController view, It looks as if the CANCEL button is under the NavigationBar. (It is hard to see in this picture.)

enter image description here

After the UIImagePickerController is popped and the view is reloaded, the NavigationBar is gone.

enter image description here

Here is how I call the UIImagePickerController. I am inheriting from UIImagePickerControllerDelegate

enter image description here

 UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = sourceType;
    imagePickerController.delegate = self;

    if (sourceType == UIImagePickerControllerSourceTypeCamera) {
        imagePickerController.showsCameraControls = YES;
    }

    self.imagePickerController = imagePickerController;
    [self presentViewController:self.imagePickerController animated:YES completion:nil];

Though the delegate is saying is it incompatible.

enter image description here enter image description here

How do I correct issue?


Solution

  • I added

    imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
    imagePickerController.modalTransitionStyle   = UIModalTransitionStyleCoverVertical;
    

    And that seemed to put the imagePickerController on top of the current view.