我有一个 UINavigationController,它链接到设置为 RootController 的 ViewController。我启用了 UINavigationBar 并放置了 3 个 UIView,每个 UIView 里面都有一个 UIButton。理想情况下,我想让 UINavigationBar 完全不可见,但我也会将颜色设置为 ViewController 的背景颜色。我正在快速工作,我尝试过类似的事情
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true
然而什么都没有改变。有正确的方法吗?
快速地,你可以这样做:
self.navigationController?.setNavigationBarHidden(true, animated: true)
请参阅文档 https://developer.apple.com/library/ios/documentation/Uikit/reference/UINavigationController_Class/index.html#//apple_ref/occ/instm/UINavigationController/setNavigationBarHidden:animated:更多细节。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)