简体   繁体   中英

Top navigation bar doesn't appear

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 .

  • Set storyboard ID for 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 在此处输入图片说明

在此处输入图片说明

Change Storyboard Id Of UINavigationController . 在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM