iOS Development (small details you don't know)---status bar

Source: Internet
Author: User

Status bar, Uistatusbar shows the basic information, such as electricity, operators and so on. Unless your application is full-screen, he will be shown at the top of the screen, which features the status bar, which takes up 20 point widths. What's the difference between the iOS6 and the iOS7 version?

Under IOS6, if Statusbarstyle is Uistatusbarstyledefault, the color of the status bar automatically changes with the color of the navigation bar, which is the average color of the navigation bar; If the modified Statusbarstyle is Uistatusbarstyleblackopaque or uistatusbarstyleblacktranslucent, it is fixed to opaque black and transparent black, and the font is white and no longer changes with the navigation bar.

Under IOS6, the status bar occupies a single height of 20 points, and the view coordinates of all views controllers are set to start at the bottom.

Under IOS6, Statusbarstyle defaults to Uistatusbarstyledefault, background color and text colors change as the navigation bar changes, and if there is no navigation bar it is black and white.

Under IOS7, Statusbarstyle defaults to Uistatusbarstyledefault, but it is a transparent background color, and its text color is black.

Under IOS7, the status bar no longer has a background color, it is a transparent background color, and he has the background color consistent with the view background closest to it, and it no longer occupies the 20-point height alone.

Under IOS7, a new property view controller-based status bar appearance is added to the project's info.plist configuration file, which defaults to Yes. (IOS6 This value does not affect) it means that the background color and text color of the status bar are based on changes in view in the view controller, so when this value is no, set the Statusbarstyle of the UIApplication, The Statusbarhidden property has an effect, and when this value is yes, the following two methods of overriding Uiviewcontroller are used to set the background color, font color, and hidden properties of the status bar:

[Self setneedsstatusbarappearanceupdate];//Update animation state

-(Uistatusbarstyle) preferredstatusbarstyle{

Returnuistatusbarstylelightcontent;

}

-(BOOL) prefersstatusbarhidden{

return NO;

}

-(Uistatusbaranimation) preferredstatusbarupdateanimation{

Returnuistatusbaranimationnone;

}

Related Article

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.