我有两个视图控制器,
当相机图标位于索引0并选择了
这是我的实现,但只能关闭
ViewControllerA
和 ViewControllerB
,它们都嵌入在一个 UINavigationController
中。 ViewControllerA
有一个 UICollectionView
来显示图片。当相机图标位于索引0并选择了
UICollectionViewCell
时,应该关闭 ViewControllerA
并显示 ViewControllerB
。同时,还有一个 ViewController
以模态方式呈现 ViewControllerA
。这是我的实现,但只能关闭
ViewControllerA
,没有其他任何反应。let controller = self.storyboard?.instantiateViewControllerWithIdentifier("cameraViewController") as! UINavigationController
self.dismissViewControllerAnimated(true, completion: { () -> Void in
self.presentingViewController?.presentViewController(controller, animated: true, completion: nil)
})
presentingViewController
是空的吗? - Jojodmoself.presentingViewController?
而不是self.presentingViewController!
。如果它是nil,那很可能是问题的原因 - 尝试打印self.presentingViewController
并查看结果。 - Jojodmo