简体   繁体   English

NavigationController中的NavigationBar没有显示在IB StoryBoard中

[英]NavigationBar from NavigationController doesn't show in IB StoryBoard

My first view is a UINavigationController with a rootview, which correctly shows a NavigationBar in IB in the .storyboard. 我的第一个视图是带有根视图的UINavigationController,该视图正确显示了.storyboard中IB中的NavigationBar。 I think this is nice when I am designing in IB, so I know the proportions, since the view is getting a little smaller with a navigationbar. 我认为在IB中进行设计时这很好,所以我知道了比例,因为导航栏使视图变小了。 This navigationbar from the navcontroller is pushed on all views in my app, but in IB the bar doesn't show, making it hard to figure out how it's going to look. 来自navcontroller的导航栏被推送到我的应用程序中的所有视图上,但是在IB中,该栏没有显示,这使得很难弄清楚它的外观。 I have chosen 'inferred' which I thought ment the NavController should automatic implement it, it is ok to just choose 'navigationcontroller' as the top bar in the Simulated Metrics? 我选择了NavController应该自动实现的“推断”功能,可以选择“ navigationcontroller”作为“模拟度量”的顶部栏吗? In some of my viewcontrollers the navigationbar is there, and all settings are 'inferred'. 在我的某些视图控制器中,导航栏在那里,并且所有设置都是“推断的”。

Thanks. 谢谢。

In each viewController in the StoryBoard file in the Attributes Inspector are several drop down menus. 在“属性”检查器的StoryBoard文件中的每个viewController中,都有几个下拉菜单。

One of them is "Top Bar". 其中之一是“ Top Bar”。

If this is set to "Inferred" then the navBar will show only if it's parent view shows the navbar (parent as in the view that segues to it). 如果将其设置为“推断”,则只有在其父视图显示导航栏时,该导航栏才会显示(父视图与选择导航栏的视图相同)。

Somewhere in your hierarchy will be one that has the Top Bar option set to None (or possibly all of them). 层次结构中的某个位置将“顶部栏”选项设置为“无”(或可能全部设置为“无”)。

Anyway, if you change this it will show the Top Bar in the IB. 无论如何,如果您更改此设置,它将在IB中显示顶部栏。

HTH. HTH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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