简体   繁体   English

故事板中的UITabBarController隐藏了UITabBarItems的内容

[英]UITabBarController in storyboard hides content of UITabBarItems

I am a beginner using storyboards for iOS. 我是一个使用iOS故事板的初学者。 I have been using the tab bar controller to show my content. 我一直在使用标签栏控制器来显示我的内容。

When I first implemented the UITabBar I could see all the icons at the bottom of the UITabController in storyboard and I could see the UITabBarItem at the bottom of each UIViewController . 当我第一次实现UITabBar我可以在故事板中看到UITabController底部的所有图标,我可以在每个UIViewController的底部看到UITabBarItem Why is there now a blank grey bar? 为什么现在有一个空白的灰色条? I can't seem to change the content either in storyboard. 我似乎无法在故事板中更改内容。 I tried adding another UITabBarController but got the same problem, it also has a dark grey bar at the bottom. 我尝试添加另一个UITabBarController但遇到了同样的问题,底部也有一个深灰色条。 However when I run the app all the icons appear. 但是,当我运行应用程序时,所有图标都会出现。 How do I fix this so I can see the UITabBarItems in storyboard or should I just try updating them programmatically instead? 我如何解决这个问题,以便我可以在故事板中看到UITabBarItems,或者我应该尝试以编程方式更新它们?

UIViewController(标签栏控制器视图)

UITabViewController

Showing a tab bar or not is one of the couple of simulated metrics used in Interface Builder. 显示标签栏与否是Interface Builder中使用的几个模拟指标之一。 As such they only serve to have an idea of how your controller would look under different conditions but do not really change anything to the actual controller. 因此,它们仅用于了解您的控制器在不同条件下的外观,但实际上并未对实际控制器进行任何更改。

Most of the time the default Inferred option will try to deduce from the Storyboard configuration how it should look like. 大多数情况下,默认的推断选项将尝试从Storyboard配置中推断它应该是什么样子。 In your case just connect the tab bar controller to your controller through the viewControllers outlet. 在您的情况下,只需通过viewControllers插座将标签栏控制器连接到控制器。

In contrast, below you have some View Controller properties that change both how your controller is previewed in Interface Builder and also its actual behavior (for instance try changing Adjusts Scroll View Insets or Extended Edges). 相比之下,下面有一些View Controller属性可以更改控制器在Interface Builder中的预览方式以及实际行为(例如尝试更改“调整滚动视图插入”或“扩展边缘”)。

在此输入图像描述

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

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