IOS 導航條 以及 狀態列顏色 相關設定
阿新 • • 發佈:2019-02-01
區域性導航欄顏色設定
//設定導航條顏色 美團導航欄顏色
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:78.0/255 green:238.0/255 blue:218.0/255 alpha:1.0];
//設定導航條文字顏色 白色
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
//設定按鈕文字顏色 白色
self.navigationController.navigationBar.setTintColor = [UIColor whiteColor]];
全域性導航欄顏色設定
/*在 AppDelegate.m 中*/
//設定導航條顏色 美團導航欄顏色
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:78.0/255 green:238.0/255 blue:218.0/255 alpha:1.0]];
//設定導航條文字顏色 白色
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
//設定按鈕文字顏色 白色
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
//設定導航欄按鈕字型大小
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:15], UITextAttributeFont,nil] forState:UIControlStateNormal];
更改狀態列顏色白色
===============2015.11.22=================
突然發現了在General裡面調節StatusBarStyle就可以了,這樣還可以解決LaunchScreen.storyboard中狀態列顏色黑色的問題。
==================Old===================
* 首先在info.plist中新增一條UIViewControllerBasedStatusBarAppearance,值為NO
* 再在程式裡寫下面的語句
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];