the problem I have is to remove the root arrow on the story board and set up the root view in the AppDelegate file to dynamically change the RootView.
There is no problem moving the root view, but the existing splashScreen(Launch Screen)
is not visible. Why can't you see it? How can I see the splashScreen(Launch Screen)
and go to the root view?
Main.Storyboard
Login.Storyboard,
Launch.Storyboard
Move Root Screen in AppDelegate.swift
var window: UIWindow?
func switchStartUI() {
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = mainStoryboard.instantiateViewController(withIdentifier: "StartViewController")
self.window?.rootViewController = viewController
}
func switchToMainUI() {
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = mainStoryboard.instantiateViewController(withIdentifier: "NavigationController")
self.window?.rootViewController = viewController
}
func switchLoginUI(_ pushtype : String) {
let loginStoryboard = UIStoryboard(name: "Login", bundle: nil)
let viewController = loginStoryboard.instantiateViewController(withIdentifier: "MainLoginController") as! MainLoginController
viewController.pushType = pushtype
self.window?.rootViewController = viewController
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
if let screenData : String = LocalStorage.get("ScreenView") as? String {
switch (screenData) {
case "success":
switchToMainUI()
case "success1":
switchLoginUI("")
case "success2":
switchLoginUI("")
default:
switchStartUI()
}
} else {
switchStartUI()
}
self.window?.makeKeyAndVisible()
return true
}
I want to see the splash screen and move on to the root view
There is already an image on my splash screen. It worked normally. But I can't see the splash screen after dynamically modifying the root view. I'm the same
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.makeKeyAndVisible()
To me, the white screen appears and then I go to the root view page.
I don't know why I can't see the splash screen.
How can I solve this problem??
Thanks in advance