在oc中設(shè)置navigationBar的顏色,毛玻璃層會(huì)影響它的顏色效果
self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];
屬性設(shè)置:
self.navigationBar.translucent = NO;
對(duì)于屬性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)