设置导航样式为黑色或者其他颜色,只需设置导航背景图和字体字色即可快速达到需求。
// 使用appearence(主题)设置,统一修改所有导航栏样式
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
//用于保存设置属性的字典
NSDictionary *textAttributes = nil;
textAttributes = @{
NSFontAttributeName: [UIFont boldSystemFontOfSize:kNavTitleFontSize],
NSForegroundColorAttributeName: KNavTitleColor
};
[navigationBarAppearance setBac
kgroundImage:[UIImage imageWithColor:RGB(10, 10, 10)] forBarMetrics:UIBarMetricsDefault];
[navigationBarAppearance setTitleTextAttributes:textAttributes];