Presenting a Modal View Controller hides the Navigation Bar

后端 未结 9 976
灰色年华
灰色年华 2021-01-04 00:58

I have a navigation based app with a navigation bar, but there are a few instances where instead of pushing a view controller onto the stack, I need to present the view cont

9条回答
  •  温柔的废话
    2021-01-04 01:39

    Make sure you a presenting AND dismissing the modalViewController from the UINavigationController, like so:

    // show
    [self.navigationController presentModalViewController:vc animated:YES];
    // dismiss
    [self.navigationController dismissModalViewControllerAnimated:YES];
    

    If your view controller is actually on the UINavigationController's stack then this is the correct way to handle the presentation and dismissal of the modal view controller. If your UINavigationBar is still hidden, there is something else funky going on and we would need to see your code to determine what is happening.

    Edit

    I copied your code into an app of mine and the UIImagePickerController successfully presented and dismissed and my UINavigationController's UINavigationBar was still there. I truly believe that the problem lays elsewhere in your architecture. If you upload a zip w/ an example project I will take a look.

提交回复
热议问题