经过大量研究后,我认为我发现问题出现在我的应用程序中,但找不到解决方案。UITabBar在UIImagePickerController模式消失后消失
在我的项目中,如截图所示,我有一个UITabBarController
作为初始视图控制器。 UINavigationController
将“显示(推送)”以显示UIViewController
。在我的UIViewController
里面,我会打电话UIImagePickerController
,这是由XCode设置在“Modal”上。
问题出现了,当我解雇UIImagePickerController
时,UITabBar项目消失。我知道这与解除模态有关,但我找不到解决方案。
我的代码如下:
上的一个按钮的点击里面UIViewController
@IBAction func chooseLibrary(sender: AnyObject) {
let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = .PhotoLibrary
picker.allowsEditing = true
self.navigationController?.presentViewController(picker, animated: true, completion: nil)
}
上的 “取消” 点击里面UIImagePickerController
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
self.navigationController?.dismissViewControllerAnimated(true, completion: nil)
}
为什么不使用self.presentViewController(picker,animated:true,completion:nil)? – jansma
物品消失或标签栏本身消失吗? – beyowulf
这是我第二次发布这个问题,并基于其他评论,他们说使用'self.navigationController?.presentViewController'。但是,无论哪种方式都行不通。 – jo3birdtalk