我有一个 UINavigationController,它链接到设置为 RootController 的 ViewController。我启用了 UINavigationBar 并放置了 3 个 UIView,每个 UIView 里面都有一个 UIButton。理想情况下,我想让 UINavigationBar 完全不可见,但我也会将颜色设置为 ViewController 的背景颜色。我正在 swift 工作,我尝试过类似的事情
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true
但是什么都没有改变。有正确的方法吗?
最佳答案
快速地,你可以这样做:
self.navigationController?.setNavigationBarHidden(true, animated: true)
请引用Documentation了解更多详情。
关于ios - 如何使导航 Controller 导航栏不可见或至少改变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24519790/