You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

嵌入Navigation Controller后导航栏不显示,StackOverflow方案无效求助

Troubleshooting Missing Navigation Bar After Embedding in Navigation Controller

Hey there! I’ve run into this exact issue a few times before, so let’s break down the most likely fixes for your missing navigation bar:

  • Double-check your segue target
    A super common mistake is linking the show segue directly to the embedded ViewController instead of the Navigation Controller itself. Head back to your Storyboard:

    1. Select the control (like a button) that triggers the segue
    2. Hold Ctrl and drag to the Navigation Controller (not the ViewController inside it)
    3. Choose show from the segue options. If you had a previous wrong segue, delete it first.
  • Check for hidden navigation bar settings
    Your navigation bar might be getting hidden accidentally, either in Storyboard or code:

    • In Storyboard: Select your ViewController, open the Attributes Inspector, and make sure the Hide Navigation Bar checkbox is unchecked.
    • In code: Look through your ViewController's viewDidLoad, viewWillAppear, or viewDidAppear methods for lines like:
      navigationController?.isNavigationBarHidden = true
      
      If you find this, either remove it or change the value to false (or adjust it to only hide when needed).
  • Verify the Navigation Controller's own settings
    Sometimes the Navigation Controller itself has its navigation bar disabled. Select your Authentication Storyboard's Navigation Controller, open the Attributes Inspector, and confirm that Shows Navigation Bar is checked (this is the default, but it can get toggled by mistake).

  • Test if segue type is causing unexpected behavior
    While show segue should work fine (it adapts to push on iPhone/popover on iPad), if you’re triggering it from a modally presented ViewController, try switching the segue to Present Modally with Presentation set to Full Screen as a quick test. If the navigation bar shows up then, the issue was likely with how the show segue was interacting with the modal context—but the first three fixes are still the most probable culprits.

内容的提问来源于stack exchange,提问作者Agung

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 03:33:15