Swift: 无法使用 imagePickerController 隐藏 Tabbar

Swift: Tabbar cannot be hidden with imagePickerController

人们请帮助我绝望... :-(

我有一个包含 4 个项目的标签栏....我将执行此操作以获得标签栏的模式视图。

self.tabBarController?.tabBar.isHidden = true
self.tabBarController?.tabBar.layer.zPosition = -1
let modal = self.storyboard?.instantiateViewController(withIdentifier: "NewTripVC") as! NewTripVC
let navigationController = UINavigationController(rootViewController: modal)
navigationController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
self.present(navigationController, animated: true, completion: nil)

在那个模式中,我有一个可以包含照片的图像视图...我正在使用图像选择器从照片库中选择图像

var imagePicker = UIImagePickerController()

if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.savedPhotosAlbum){
   self.imagePicker.delegate = self
   self.imagePicker.sourceType = UIImagePickerControllerSourceType.savedPhotosAlbum;
   self.imagePicker.allowsEditing = false
   self.imagePicker.navigationBar.isTranslucent = false
   self.present(self.imagePicker, animated: true, completion: nil)
}

然后我用它来关闭....但是当视图关闭时...标签栏会弹出,我无法隐藏它:-(

//this will dismiss the view but also will show tabBar that can't be hidden with any way
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
   imagePicker.dismiss(animated: true, completion: nil)
}

我试过了...但这不起作用...:[=​​16=]

self.tabBarController?.tabBar.isHidden = true
self.tabBarController?.tabBar.layer.zPosition = -1

好吧,答案很简单。变化

navigationController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext

对这个.....太蹩脚了

navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen