c# - 如何从 LaunchScreen.Storyboard 初始化 ViewController
问题描述
当我尝试在另一个 ViewController 中从Main.Storyboard实例化 ViewController 时,我会执行以下操作:
SplashViewController splashVC = Storyboard.InstantiateViewController("Splash") as SplashViewController;
Storyboard 是“创建此 UIViewController 的 UIStoryboard”。
但是,此时我需要从 LaunchScreen.Storyboard实例化 ViewController 。
解决方案
LaunchScreen.Storyboard
如果您需要立即启动应用程序,则不应编写代码,您可以编写代码FinishedLaunching
,因为它是启动后不久调用的第一个方法。在这里写下你的代码。
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
推荐阅读
- java - string.split(\\s+) 无法处理前导空格
- python - 卸载用户在 macOS High Sierra 上使用 pip 安装的所有软件包
- php - 从标准 HTML 页面中访问 php 服务
- android - 应用程序在某些设备上显示默认图标,但在其他设备上不显示
- css - 使用 Img Materialise CSS 更改范围图标
- binary - 无符号二进制整数减法
- docker - 主机重启后 Docker 容器没有出现
- python - 在 appengine 标准环境下将应用程序从 Python2 迁移到 Python3
- scala - 为什么这个 Scala 代码返回 NullPointerException?
- python - Remove comma only in specific locations