前几天在设置NavigationController 的时候,公司要求将title的颜色更换一下,黑色过于深沉,特意分享一下如何将title设置为我们自定义的颜色。
//宏定义
#define ThemeColor(colorname)[ [ ThemeManager shareInstance ] getColorWithName:colorname ];
//ThemeManager 自定义的类,shareInstance单利,getColorWithName:自定义的得到颜色的方法
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:ThemeColor(@“按钮默认的颜色”) forKey:NSForgroundColorAttributeName];
//默认情况下“美人app”是黑色的字体,经过设置之后变成了红的字体。