IOS screen origin coordinates && navigation bar style customization

Source: Internet
Author: User

One

The screen origin coordinates (x, y) are subject to Self.navigationcontroller. Navigationbar's settranslucent (BOOL) property controls

After iOS7, the translucent property defaults to Yes for the property meaning is the translucent effect of the frosted glass

YES starting coordinates are (0, 0) at the top left corner of the screen, where the UI is displayed through the navigation bar

No starting coordinates for the top left corner of the screen is (0, 20 + 44) This indicates that the starting coordinates are not frosted glass at the beginning of the navigation bar at the bottom of the status bar and navigation bar.

Second

We know that the navigation controller is the control root of the whole is unified state, so to use the system's navigation controller change style is to change the whole then if you want to customize one of the pages, you must restore the system design state of the navigation bar when exiting the current page

The rest in the actual combat slowly realize extrapolate effect can come out

For example

+(void) Setnormalgreennav: (Uinavigationcontroller *) navigationcontroller{[Navigationcontroller.navigationbar Settranslucent:no]; if(Floor (Nsfoundationversionnumber) <=Nsfoundationversionnumber_ios_6_1) {[Navigationcontroller.navigationbar settintcolor:[uicolor colorwithred:0.25Green0.65Blue0.35Alpha1]]; [Navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"Header.png"] Forbarmetrics:uibarmetricsdefault]; } Else{[Navigationcontroller.navigationbar setbackgroundimage:nil forbarmetrics:uibarmetricsdefault]; [Navigationcontroller.navigationbar Settintcolor:[uicolor Whitecolor];        //navigation bar text color [Navigationcontroller.navigationbar Setbartintcolor:color_theme_green]; //navigation bar background color }}+(void) Cancelnormalgreennav: (Uinavigationcontroller *) navigationcontroller{[Navigationcontroller.navigationbar Settranslucent:yes]; [Navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed: @ "header_newblack2" ] Forbarmetrics:uibarmetricsdefault]; //This is a translucent picture }

Its three

Bug Analysis above method overall style is green navigation non-frosted glass effect which occasionally appears transparent frosted glass effect this time if the start coordinate height change when switching 0--(20 + 44) There will be a black horizontal bar over the visual UI this I handled this by adding a UI delay of about 0.8 seconds to avoid seeing this black horizontal bar

IOS screen origin coordinates && navigation bar style customization

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.