swift - 从隐藏的选项卡 View Controller 单击后退按钮时如何显示选项卡

标签 swift uinavigationcontroller uitabview

我创建了一个选项卡栏 Controller ,并从一个选项卡项中将 segue 设置为导航 View Controller 。我创建了一些附加到导航 Controller 的 View Controller 。因此,在一个 View Controller 中,我不需要选项卡,因此在该 Controller 中,我编写了隐藏选项卡栏 Controller 的 self.tabBarController?.tabBar.isHidden = true

当我从隐藏的选项卡 View Controller 单击导航 Controller 的后退按钮到上一个 Controller 时,它不显示以前 Controller 中的选项卡栏项目。但是除了一个 View Controller 之外,我需要所有 View Controller 中的选项卡。为什么不显示标签?

这是我的 Storyboard:

enter image description here

最佳答案

你可以在隐藏选项卡之前的 VC 中尝试这个

 override func viewWillAppear(_ animated:Bool) {
    super.viewWillAppear(animated)
    self.tabBarController?.tabBar.isHidden = false
}

关于swift - 从隐藏的选项卡 View Controller 单击后退按钮时如何显示选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51582676/

相关文章:

ios - 核心数据私有(private)上下文 performAndWait 导致调试崩溃

ios - 在基于选项卡的应用程序中的两个选项卡项之间共享场景/ View 布局

ios - 在 UINavigationController 堆栈 (IOS7) 的 UIWebview 中播放嵌入式视频的问题

iphone - 每个 View 的单独 UINavigationBars

ios - 用默认值替换自定义后退按钮

xcode - 一旦我在代码和界面之间建立连接,我的选项卡就会崩溃(iOS SDK 4.2)

ios - 我可以只在标签栏项目中显示文本并更改样式和位置吗

ios - HKStatisticsCollectionQuery 工作一天然后停止。如何让更新处理程序无限期地工作?

swift - 上下文类型 cgfloat 不能与数组文字一起使用

swift - 将文件拖放到 swift 应用程序中