ios - 弹出 UIImagePickerController 后 UINavigationBar 消失

标签 ios uinavigationcontroller uinavigationbar uiimagepickercontroller

我有一个嵌入在 UITabBarController 中的 UIViewController。在我的 PhotoViewController 上,用户可以选择添加照片并调用 UIImagePickerController。用户选择照片并弹出 View 后,导航栏消失。

显示导航栏。

Start

这是 UIImagePickerController View ,看起来好像取消按钮在 NavigationBar 下。 (在这张图片中很难看到。)

enter image description here

UIImagePickerController 弹出并重新加载 View 后,NavigationBar 消失了。

enter image description here

下面是我如何调用 UIImagePickerController。我继承自 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];

尽管代表说它不兼容。

enter image description here enter image description here

如何纠正问题?

最佳答案

我加了

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

这似乎将 imagePickerController 置于当前 View 之上。

关于ios - 弹出 UIImagePickerController 后 UINavigationBar 消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37999095/

相关文章:

iphone - UINavigationController:推送的 View 何时收到 Dealloc 消息?

ios - 在IOS中自定义UINavigationBar而不使用UINavigationController设置背景图像不起作用

ios - 如何在 iOS 11 中正确设置 UINavigationBar 高度

ios - 在应用商店审核并接受后,我可以编辑我的应用代码吗?

ios - 如何使用 UIPanGestureRecognizer move 2 个或更多 UIImageViews

ios - 通用应用程序和在 ios 中转换 Storyboard的最佳方式是什么

ios - firstAppear 不起作用,ViewController 每次都会初始化

ios - 将 UINavigationItem 设置为 nil 后,如何重新添加它?

ios - 如何在屏幕导航期间删除 ios 中的黑色?

iphone - 在应用程序更新时,自定义 plist 文件将得到更新,或者我们需要做些什么吗?