ImagePicker关闭标签栏导航

ImagePicker关闭标签栏导航

我有一个提供了NavigationController的选项卡栏控制器。在其中一个ViewController中,我添加了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)
    }

如何避免这种情况?我试图查看是否已将Tabar设置为隐藏在某处,例如在viewWillAppear中,但是没有。

任何想法,任何帮助将不胜感激!

最佳答案

我发现了错误,我需要显示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)
        }
    }

关于ios - ImagePicker关闭标签栏导航 Controller ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33312288/

10-10 22:11