0
我有两个VC(的ViewController,SettingsVC,VC2)。在启动时,打开指定的ViewController
我怎样才能让这个当你打开开关(位于SettingsVC)当应用程序启动时,它会显示VC2?
默认值为ViewController。
我有两个VC(的ViewController,SettingsVC,VC2)。在启动时,打开指定的ViewController
我怎样才能让这个当你打开开关(位于SettingsVC)当应用程序启动时,它会显示VC2?
默认值为ViewController。
写代码didFinishLaunchingWithOptions
-
let isSwitchOn = UserDefaults.standard.bool(forKey: "isSwitchOn")
if isSwitchOn {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc2 = storyboard.instantiateViewController(withIdentifier: "Your identifier")
self.window!.rootViewController = vc2;
}
设置isSwitchOn
在SettingsVC
这样的 -
UserDefaults.standard.set(true, forKey: "isSwitchOn")
有任何闪屏控制器出现在你的应用程序? – CodeChanger