我有一个包含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)
}
我试过了......但这不起作用......:
self.tabBarController?.tabBar.isHidden = true
self.tabBarController?.tabBar.layer.zPosition = -1
答案 0 :(得分:0)
答案很简单。变化
navigationController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
对此......如此蹩脚
navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen