I have an issue in iOS7 where a normal UINavigationController pushed view controller has the correct status bar text color for the UINavigationController navbar color (which is a light gray, almost white so the status bar text is black). However, when a "modal" view controller is presented using -presentViewController:animated:completion:
, the status bar text color is changed to white and is very hard to see given the color of the navbar. Navbar color is always the same across the whole app and does not change for each view controller. This happens on every -presentViewController
call.
"View controller-based status bar appearance" is set to YES.
I am not sure what to look at to try and solve this.
I just figured out how to do that. I had the exact same problem and it seems that it works like a charm!
The first thing you need to do is to change an attribute in you .plist file of your project to NO. The attribute is: "View controller-based status bar appearance". If the attribute doesn't exist, don't hesitate to add a new one exactly as I just written to you (without quotes).
The second thing is to add to each view controller's viewDidLoad method
if you want your status bar's text to be white or
if you want your status bar's text to be black.
That's all!
set YourModalViewControler.modalPresentationCapturesStatusBarAppearance to YES and keep "View controller-based status bar appearance" to YES.
then overwrite preferredStatusBarStyle
Having reviewed all the answers provided here and in other answers, I have found that the only solution that worked for me was to create a vacuous navigation bar for the view controller I am presenting modally.
This may not work for you, but it works for me for the following reasons:
applicationDidFinishLaunching
as discussed above, and it has a custom colour.It's somewhat annoying from an engineering perspective to have a navigation controller that effectively does nothing, but without one I was unable to get past this problem.