OStack程序员社区-中国程序员成长平台

标题: ios - UIImagePickerController 弹出后 UINavigationBar 消失 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 17:02
标题: ios - UIImagePickerController 弹出后 UINavigationBar 消失

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

显示导航栏。

Start

这是 UIImagePickerController View ,它看起来好像 CANCEL 按钮位于 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

如何纠正问题?



Best Answer-推荐答案


我加了

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

这似乎把 imagePickerController 放在了当前 View 的顶部。

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






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4