iOS status bar settings for font color

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.