ios NavigationBar層級和顏色設置

在oc中設置navigationBar的顏色,毛玻璃層會影響它的顏色效果

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

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)

參考鏈接

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容