代码之家  ›  专栏  ›  技术社区  ›  Harrison

顶部导航栏不显示

  •  0
  • Harrison  · 技术社区  · 8 年前

    我有一个顶部导航栏,上面有一个注销按钮,该按钮将用户返回到登录屏幕,并从他们的钥匙链中擦除他们的访问令牌。

    我正在努力添加一个滑出菜单栏,然而,我的顶部导航栏没有出现,我似乎无法让它出现。

    我使用以下代码摘录介绍了成功登录时的这一观点:

    DispatchQueue.main.async {
        let homePage = 
            self.storyboard?.instantiateViewController(withIdentifier:
            "HomePageViewController") as! HomePageViewController
        self.present(homePage, animated: true)
    }
    

    1 回复  |  直到 8 年前
        1
  •  1
  •   trungduc 邱林和    8 年前

    而不是现在 HomePageViewController ,您必须出示 UINavigationController 属于 HomePageViewController .

    • 设置序列图像板ID UINavigationController 属于 HomePageViewController . 例如,您为设置序列图像板ID UINavigationController 是 HomePageNavigation
    • 用下面的代码替换您的代码。

      DispatchQueue.main.async {
          let homePage = 
              self.storyboard?.instantiateViewController(withIdentifier:
      "HomePageNavigation") as! UINavigationController
          self.present(homePage, animated: true)
      }
      

    选择 UINavigationController 属于 HomePageController 在情节提要上 enter image description here

    enter image description here

    更改序列图像板Id UINavigationController . enter image description here