About changing the status bar color after iOS7

Source: Internet
Author: User

See the Internet said after iOS7 to set this

First, you need to add the key: Uiviewcontrollerbasedstatusbarappearance in the Info.plist configuration file, and set it to Yes;

Then, implement the following two methods in the Uiviewcontroller subclass:

- (Uistatusbarstyle) preferredstatusbarstyle{    return  uistatusbarstylelightcontent;} - (BOOL) prefersstatusbarhidden{    return  NO; Finally, when you need to refresh the status bar style, call the [self setneedsstatusbarappearanceupdate] method to refresh the note:
[Self setneedsstatusbarappearanceupdate] is  invoked within the controller of push or present.

The strange thing is that I only after the login interface useful interface login Jump (the right to say that it should not jump when the network request data after the status bar color becomes black, and in the next interface how to set up is useless, Perhaps because I login interface is present past or what reason, do not discuss this color will change back , do not know whether this method has a problem, or my code has a problem.

Then I looked for one that was available in my project. Slightly modified, because I just entered the interface will have a Zhang Quan diagram .

call Setstatusbarstyle any iOS version availablein the plist file
in your code
    if (isios7later) {        [[uiapplication sharedapplication] setstatusbarhidden:no];        [[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent];    }

And I also found that ios6.0, the login interface has no status bar. (Login interface is not NAVG)

if (! Isios7later) {

[uiapplicationsharedapplication]. Statusbarhidden =NO;

}

。。。
Hey, exactly why ?
- (Uistatusbarstyle) Preferredstatusbarstyle
This method in another interface is not enough or later to study it is estimated to be my code problem.


About changing the status bar color after iOS7

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.