Vol*_*lçi 2 uiviewcontroller ios swift
我有一个包含教程的视图控制器,我只想在第一次打开应用程序时将其显示为初始视图。之后,我想展示我的主视图控制器。
在您的应用程序启动后,它将调用应用程序委托中的 didFinishLaunchingWithOptions 方法:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// here you have the chance to change your rootview controller
if(UserDefaults.standard.bool(forKey: "notFirstInApp") == false){
UserDefaults.standard.set(true, forKey: "notFirstInApp")
window?.rootViewController = your tutorial view controller
}else{
window?.rootViewController = your main viewcontroller
}
return true
}
Run Code Online (Sandbox Code Playgroud)