After taking over a project some time ago, I found a lot of problems in the familiar process, one of which is the problem of the status bar.
We all know: the status bar font color in different interface, because the system settings when the status bar font color of the interface controller set the Yes.
So the question is, if I customize the navigation bar, and the status bar font color is want to unify color, how to do?
method One: we can set the interface to one interface, because Apple has given the system method:
// The default value is black -(uistatusbarstyle) preferredstatusbarstyle{ return Uistatusbarstyledefault; } // whether to hide the status bar - (BOOL ) prefersstatusbarhidden{return NO;}
This, of course, is cumbersome, and we do not recommend it, and this happens: the setting does not show the effect.
method Two: Set the font color of the status bar in application (recommended)
typedef ns_enum (Nsinteger, Uistatusbarstyle) {Uistatusbarstyledefault=0,//Dark content, for use in light backgroundsUistatusbarstylelightcontent Ns_enum_available_ios (7_0) =1,//Light content, for use on dark backgroundsuistatusbarstyleblacktranslucent Ns_enum_deprecated_ios (2_0, 7_0,"Use uistatusbarstylelightcontent") =1, Uistatusbarstyleblackopaque Ns_enum_deprecated_ios (2_0, 7_0,"Use uistatusbarstylelightcontent") =2,}
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{ // Set the status bar font color [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent Animated:YES];}
If this is only set in the Settings application, and there is no use, but also need some configuration before the line, specifically as follows:
Add in the plist file:View controller-based status bar appearance and set to NO .
iOS status bar settings for font color