I have a top navigation bar that has a logout button which returns the user back to the login screen and wipes their access token from their keychain.
I am working on adding a slide out menu bar, however, my top navigation bar is not appearing and I can't seem to get it to appear.
I am presenting this view on successful login using the following excerpt of code:
DispatchQueue.main.async {
let homePage =
self.storyboard?.instantiateViewController(withIdentifier:
"HomePageViewController") as! HomePageViewController
self.present(homePage, animated: true)
}
Instead of present HomePageViewController
, you have to present UINavigationController
of HomePageViewController
.
UINavigationController
of HomePageViewController
. For example, you set storyboard ID for UINavigationController
is HomePageNavigation
Replace your code with the code below.
DispatchQueue.main.async { let homePage = self.storyboard?.instantiateViewController(withIdentifier: "HomePageNavigation") as! UINavigationController self.present(homePage, animated: true) }
Select UINavigationController
of HomePageController
on Storyboard
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.