iOS UINavigationController修改導航欄標題、按鈕文字以及背景的顏色
阿新 • • 發佈:2018-12-31
//方法一
- (void)setNav {
// 導航欄背景顏色
[self.navigationController.navigationBarsetBarTintColor:[UIColorcolorWithRed:0.000green:0.800blue:0.800alpha:1.000]];
// 導航欄標題字型顏色
[self.navigationController.navigationBarsetTitleTextAttributes:@{NSFontAttributeName:[UIFontsystemFontOfSize:19],NSForegroundColorAttributeName :[UIColorwhiteColor]}];
// 導航欄左右按鈕字型顏色
self.navigationController.navigationBar.tintColor = [UIColorwhiteColor];
}
//方法二
//設定導航欄背景顏色
UINavigationBar *bar = [UINavigationBarappearance];
bar.barTintColor = [UIColorcolorWithRed:62/255.0green:173/255.0blue:176/255.0alpha:1.0];
//設定字型顏色
bar.tintColor = [UIColor whiteColor];
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];