我有 Login Screen 并且在用户成功登录后我想打开我的 Dashboard ,但问题是我无法这样做 .
我已就该主题进行了大量研究,但每个链接都指出了 UICollectionView
打开 UIViewController
的位置,但反之亦然 .
Approach 1
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("homeScreen") as UIViewController
self.presentViewController(viewController, animated: true, completion: nil)
Approach 2
let homeController = (self.storyboard?.instantiateViewControllerWithIdentifier("homeScreen"))! as UICollectionView
self.navigationController?.pushViewController(homeController, animated: true)
当我使用上面的代码时,我得到一个黑屏 .
2 回答
通常情况下,您在
viewDidLoad()
中拥有myCollectionView.delegate = self
和myCollectionView.dataSource = self
的黑屏 .检查您的实用程序>连接是否有如下所示的segues:
由于连接无效,这可能会创建黑屏 . 如果有,请单击 x 断开第二个View .