我正在尝试访问 Storyboard的初始 View Controller 。它是一个导航 Controller ,通过序列连接到第二个 View Controller 。因此,在我的应用程序完成启动后,我想直接显示通过 segue 连接的 viewController。我用这样的代码试过了,但它不起作用......
UINavigationController *navController = (UINavigationController*)self.window.rootViewController;
[navController.topViewController performSegueWithIdentifier:@"showLoginScreen" sender:self];
我做错了什么?
4 年后:
如果我在 4 年后再次查看我的问题,老实说,我不知道我真正的问题是什么。
最佳答案
确保你已经勾选了
is initial ViewController
storyBoard 中 UINavigationController
的选项
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UINavigationController * myStoryBoardInitialViewController = [storyboard instantiateInitialViewController];
关于iphone - 从 App Delegate 中的 Storyboard获取初始 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13289158/