解雇UIImagePickerController时UITabBar消失

时间:2016-01-21 04:41:17

标签: ios swift uiviewcontroller

在我的截图中,我的故事板的结构是UITabBarController - > UINavigationController - > UIViewController。在我的UIViewController中,我使用.Camera中的UIImagePickerController来致电viewDidLoad。但是,当用户在相机内点击取消时,我会关闭ViewController,而我的标签栏会消失!

这是我的解雇代码:

func imagePickerControllerDidCancel(picker: UIImagePickerController) {
    dismissViewControllerAnimated(true, completion: nil)
}

enter image description here

enter image description here

编辑:添加了对UIImagePickerController的调用

override func viewDidLoad() 
   {
         super.viewDidLoad()

         let picker = UIImagePickerController()
         picker.delegate = self
         picker.sourceType = .Camera
         presentViewController(picker, animated: true, completion: nil)
   }

1 个答案:

答案 0 :(得分:0)

尝试呈现imagePicker控制器'OverCurrentContext'

imagePicker.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext

或在UIViewController的Storyboard中设置它,希望它可以帮助你。

enter image description here

相关问题