简体   繁体   English

TableViewController iOS 中未显示底栏

[英]Bottom bar doesn't show up in TableViewController iOS

I have two TableViewControllers embedded in NavigationController, and I want to add bottom bar to the second table view controller.我在 NavigationController 中嵌入了两个 TableViewController,我想将底栏添加到第二个表格视图 controller。 In the interface editor, I choose Opaque Tab Bar and it shows on the screen in the MainStoryboard, but when I build the app there is no bottom bar.在界面编辑器中,我选择了不透明标签栏,它显示在 MainStoryboard 的屏幕上,但是当我构建应用程序时,没有底栏。 Could you tell what is the reason why it doesn't show up and how to fix it?你能告诉它不显示的原因是什么以及如何解决它? 在此处输入图像描述

Storyboard is showing you Simulated metrics. Storyboard 正在向您展示模拟指标。

Add this to your Cards view controller class:将此添加到您的Cards视图 controller class:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.setToolbarHidden(false, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    navigationController?.setToolbarHidden(true, animated: false)
}

That will show the ToolBar (the "bottom" bar) when the view is about to appear, and hide it when the view is about to disappear.这将在视图即将出现时显示工具栏(“底部”栏),并在视图即将消失时隐藏它。

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

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