2016-11-29 62 views
1
隐藏

的人,请帮助我绝望... :-(斯威夫特:的TabBar不能imagePickerController

我有4项的TabBar ....我会执行此过度使用TabBar获取模式视图。

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

然后我用这对关闭的形象图.... BU T当视图被关闭...标签栏会弹出,我无法隐藏它:-(

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

+0

你有没有试图把self.tabBarController?.tabBar.isHidden =真 self.tabBarController?.tabBar.layer.zPosition = -1在imagepicker关闭完成块内? – Sreekanth

回答

0

那么答案很简单。更改

navigationController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext 

对此.....所以跛脚

navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen