ios NavigationBar层级和颜色设置

在oc中设置navigationBar的颜色,毛玻璃层会影响它的颜色效果

self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];

ios NavigationBar层级和颜色设置_第1张图片
Debug

属性设置:

self.navigationBar.translucent = NO;

对于属性translucent苹果官方文档给出解释:

 NS_AVAILABLE_IOS(3_0) UI_APPEARANCE_SELECTOR; // Default is NO on iOS 6 and earlier. Always YES if barStyle is set to UIBarStyleBlackTranslucentDescription

A Boolean value indicating whether the navigation bar is translucent (YES) or not (NO).The default value is YES. If the navigation bar has a custom background image, the default is YES if any pixel of the image has an alpha value of less than 1.0, and NO otherwise.If you set this property to YES on a navigation bar with an opaque custom background image, the navigation bar will apply a system opacity less than 1.0 to the image.

If you set this property to NO on a navigation bar with a translucent custom background image, the navigation bar provides an opaque background for the image using black if the navigation bar has UIBarStyleBlack style, white if the navigation bar has UIBarStyleDefault, or the navigation bar’s barTintColor if a custom value is defined.Availability    iOS (3.0 and later), tvOS (3.0 and later)

参考链接

你可能感兴趣的:(ios NavigationBar层级和颜色设置)