如何在iOS 7中更改导航栏颜色?
基本上我想要实现像Twitter Nav Bar这样的东西(更新的Twitter iOS7
就是这样).我嵌入了一个导航栏view controller
.我想要的是将导航栏颜色更改为浅蓝色以及顶部的实用工具栏.我似乎找不到我的选择storyboard
.
尝试iOS 7做了:
[[UINavigationBar appearance] setTranslucent:NO];
Run Code Online (Sandbox Code Playgroud)
遇到了崩溃和错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzleForSetter:'
*** First throw call stack:
(0x16ad9b8 0x142e8b6 0x16ad7ab 0x72163d 0x724c34 0x169daca 0x169d8de 0x6c09 0x228ea9 0x2296e9 0x22ab5e 0x240a6c 0x240fd9 0x22c7d5 0x35a4906 0x35a4411 0x16293e5 0x162911b 0x1653b30 0x165310d 0x1652f3b 0x22a2b1 0x22c4eb 0x6f3d 0x1d0d725)
libc++abi.dylib: terminating with uncaught exception of type NSException
Run Code Online (Sandbox Code Playgroud)
其他通话工作正常:例如.
[[UINavigationBar appearance] setBarStyle: UIBarStyleBlack];
Run Code Online (Sandbox Code Playgroud)
当我在本地设置半透明时,它不会崩溃:
[self.navigationController.navigationBar setTranslucent:NO];
Run Code Online (Sandbox Code Playgroud)
我假设这是特定于iOS 7,但还没有在iOS 6中尝试相同的东西.