ImagePicker关闭tabBar Nav Controller

KML*_*KML 1 ios swift

我有一个Tab Bar Controller,它提供了一个NavigationController.在其中一个ViewControllers中,我推动了这一点,我添加了imagePickerController来选择一张照片.当我取消或选择图片时,标签栏消失...我试图寻找答案,但我找不到引用我的具体问题的答案.

这是我的图像选择器方法

    @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)
    }
Run Code Online (Sandbox Code Playgroud)

我怎么能避免这个?我试着看看我是否将tabar设置为隐藏在viewWillAppear之类的地方但是号码.

任何想法,任何帮助将非常感谢!

KML*_*KML 5

我发现错误,我需要提供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)
        }
    }
Run Code Online (Sandbox Code Playgroud)