Why does my status bar (despite being set to "black opaque") turn grey when I change the navigationController's background color?

StackOverflow https://stackoverflow.com/questions/17912950

Вопрос

In my app, I have the status bar's style set to Black Opaque under Summary in the app's target. However, when I change my navigationController's background color with self.navigationController.view.backgroundColor = self.view.backgroundColor; the color suddenly changes to grey.

Before:

enter image description here

After:

enter image description here

Why is this? What can I do to prevent this from happening?

Despite it being set as black opaque in the app Summary, it says translucent when I NSLog it. Why?

Это было полезно?

Решение 2

Groan. My AppDelegate was changing it to translucent.

Другие советы

You should disable status bar tinting. From iOS 6.0 release notes:

It is now possible to set status bar tint parameters in your app’s Info.plist file. You might do this to ensure that the status bar color matches your app’s navigation bar color during startup. To set the status bar tint, add the UIStatusBarTintParameters key to your Info.plist file. The value of this key is a dictionary with the appropriate values describing the navigation bar your app has at startup. Inside the dictionary should be the UINavigationBar key, which has a value that is also a dictionary. That dictionary contains the initial navigation bar’s style (with the Style key) and indicates whether it is translucent (with the Translucent key). You can also specify your navigation bar’s tint color (with the TintColor key) or the name of its custom background image (with the BackgroundImage key).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top