First
The origin of the screen coordinate (x, y) by self.navigationController. NavigationBar of setTranslucent (BOOL) attribute control
After iOS7 translucent property defaults Attribute Meaning YES The frosted glass is translucent
YES starting coordinates for the top left corner of the screen is (0, 0), the content can be displayed at this time through the UI navigation bar
NO starting coordinates of the top left corner of the screen is (0, 20 + 44) This illustrates the starting coordinate and navigation bar in the bottom status bar and the navigation bar will be no effect of frosted glass
Second
We know that the root of the navigation controller to control the overall state of unity is so navigation controller wants to change the system is to change the whole style so if you want to customize a page, then when you exit the current page which must restore the system design state of the navigation bar
Remaining in actual combat experience slowly learn by analogy effects can come out
E.g
+(void)setNormalGreenNav:(UINavigationController *)navigationController { [navigationController.navigationBar setTranslucent:NO]; if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { [navigationController.navigationBar setTintColor:[UIColor colorWithRed:0.25 green:0.65 blue:0.35 alpha:1]]; [navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"header.png"] forBarMetrics: UIBarMetricsDefault]; } else { [setBackgroundImage There navigationController.navigationBar: nil forBarMetrics: UIBarMetricsDefault]; [navigationController.navigationBar setTintColor: [UIColor whiteColor]]; text color // navigation bar [navigationController.navigationBar setBarTintColor: COLOR_THEME_GREEN]; background color of the navigation bar // } } + ( void ) cancelNormalGreenNav: (* the UINavigationController ) navigationController { [navigationController.navigationBar setTranslucent: YES]; [setBackgroundImage There navigationController.navigationBar: [the UIImage the imageNamed: @ " header_newblack2 " ] forBarMetrics: UIBarMetricsDefault]; // this is a translucent image }
Third
bug analysis of the above method the overall style of navigation is no green frosted glass effect which occasionally appear transparent frosted glass effect this time if the switch when starting coordinates height variation 0 - (20 + 44) will be a black bar over-visual UI appears that I deal the UI is to add a delay of about 0.8 seconds to avoid seeing this black bar
Reproduced in: https: //www.cnblogs.com/someonelikeyou/p/4635383.html