Nav bar set to translucent black displaying white on simulator

时间:2017-08-30 21:01:19

标签: swift3 uinavigationbar xcode8

I'm looking to change the nav bar of my view controller to the translucent black setting using the simulated metrics. Unfortunately, when run, the simulator still appears white. I've looked through numerous SO questions regarding the various attempts - nav bar manipulation through simulated metrics, changing the status bar style via the app delegate and in my view controller and playing with the view controller-based status bar in the info.plist. Unsure how to approach my problem from here.

enter image description here

1 个答案:

答案 0 :(得分:0)

在Xcode中添加导航栏:

然后您可以使用以下代码更改导航栏颜色:

UINavigationBar.appearance().barTintColor = UIColor.black
UINavigationBar.appearance().isTranslucent = true

如果您想在故事板中应用它,那么

enter image description here

相关问题