2015-10-23 73 views
1

我有一个提供导航控制器的选项卡栏控制器。在其中一个ViewController中,我将其添加到顶部,添加imagePickerController以选择一张照片。当我取消或选择一张图片的标签栏消失...我试图寻找答案,但我找不到一个引用我的具体问题。ImagePicker解除tabBar导航控制器

这里是我的图片选择器方法

@IBAction func attachImageBtnTapped(sender: AnyObject) { 
     if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){ 
      imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary 
      imagePicker.modalPresentationStyle = UIModalPresentationStyle.CurrentContext 
      self.presentViewController(imagePicker, animated: true, completion: nil) 
     } 
    } 

    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { 
     attachImageBtn.backgroundColor = UIColor.greenColor() 
     dismissViewControllerAnimated(true, completion: nil) 
    } 

我怎样才能避免这种情况?我想看看如果我设置塔巴尔在viewWillAppear中,但第

任何想法在某处被隐藏的喜欢,任何帮助将非常感谢!

+0

我点击取消的TabBar幻灯片的那一刻(动画)跌 – KML

+0

@马特它没有隐藏.... – KML

+0

如果self.tabBarController?.tabBar.hidden ==真{ 打印( “隐藏”) } else { print(“not hidden”) } – KML

回答

4

我发现了错误,我需要呈现imagePicker控制器“OverCurrentContext”。

@IBAction func attachImageBtnTapped(sender: AnyObject) { 
     if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){ 
      imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary 
      imagePicker.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext 
      self.presentViewController(imagePicker, animated: true, completion: nil) 
     } 
    }