Fails to work if logout and then back in
MaeseppTarvo opened this issue · 0 comments
MaeseppTarvo commented
I checked it out also and it seems that the problem is that if you "logout" and set your initial viewcontroller to your welcome view and "log in" again. It keeps the previous menu underneath. If you "Log back in" then even the selected index is the last one.
I am using this to instantiate(log out) the "WelcomeViewController" and I think that is the problem.
let storyboard = UIStoryboard(name: "Landing", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "WelcomeViewController")
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController = controller
And that is how I "log in":
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "NavigationController")
let appDelegate = UIApplication.shared.delegate as! AppDelegate
self.dismiss(animated: false, completion: {
appDelegate.window?.rootViewController = controller
})
You can check out the following images:
- This is in normal phase
- This is after logout and back login