gpt4 book ai didi

Swift:无法使用 imagePickerController 隐藏 Tabbar

转载 作者:行者123 更新时间:2023-11-28 08:22:43 25 4
gpt4 key购买 nike

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

我有一个包含 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)

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

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)
}

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

//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)
}

我试过了...但这不起作用...:

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

enter image description here

最佳答案

嗯,答案很简单。变化

navigationController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext

为了这个.....太蹩脚了

navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen

关于Swift:无法使用 imagePickerController 隐藏 Tabbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40862859/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com