ios - how do I hide footer of all view controller witch attach with my navigation controller in swift project?
问题描述
I am working on swift project, which uses Xcode 9 and swift 4.1. I created one navigation viewcontroller and then created other view controller and attached with that that navigation viewcontroller.
so I got header and footer by default.so I have a two problems,
Now I want a change a color of footer other than white but when I write any code for that It diminished behind footer and I don't see any color without white.How do I give any color to footer?
If I am not able to give color to footer so I want to hide that footer using bellow code
override func viewWillAppear(animated: Bool) { self.navigationController?.navigationBarHidden = true }
But by this color I am able to hide only header not a footer. so how do I hide footer using code so I created customise footer what I want.
How do I solve above problem in swift 4.1?
解决方案
我不知道您在这里所说的页脚是什么意思,因为默认情况下,当您将视图控制器嵌入导航控制器时,它不会显示任何页脚。您在那里做两件可能的事情:
- 您的导航控制器嵌入在 TabBarController 中
- 或者您已取消隐藏导航控制器的工具栏。
现在,如果您使用 TabBarController 作为导航控制器的父级,您可以简单地使用以下代码来隐藏页脚:
self.tabBarController?.tabBar.isHidden = true
如果您使用导航控制器的工具栏(默认情况下隐藏)。您可以使用以下代码来隐藏它:
navigationController?.setToolbarHidden(true, animated: false)
要更改工具栏的颜色,您可以简单地使用:
navigationController?.toolbar.barTintColor = .black
推荐阅读
- android - 新鲜的Android studio项目很多错误
- python - Python 和正则表达式将 wrtitten 数字转换为数字
- javascript - 组件加载导致“尚未为上下文加载模块名称”
- macos - 如何在 macOS 上拦截 Thunderbolt 数据包?
- c - AVR 中断的变量在 main 中更新
- python - 如何在张量流上减少 Word2Vec 模型中的损失
- java - Intellij IDEA 的自定义插件可以在其代码中使用 DI 吗?
- python - How to insert strings from one column of pandas DataFrame to another column at specific index?
- mysql - Mysql Query Gives Duplicate Rows
- javascript - 从另一个 html 站点更改段落文本