1. 创建自定义UINavigationController
@implementation WWNavigationController
2. 重写 + ( void )initialize
+ (void)initialize, 在这个方法中设置背景图片和导航条标题的颜色和字体
{
UINavigationBar *bar = [UINavigationBar appearanceWhenContainedIn:[WWNavigationController class], nil];
[bar setBackgroundImage:[UIImage imageNamed:@"BackgroundImage"] forBarMetrics:UIBarMetricsDefault];
// 设置导航条的标题颜色
NSMutableDictionary *titleText = [NSMutableDictionary dictionary];
titleText[NSForegroundColorAttributeName] = [UIColor whiteColor];
titleText[NSFontAttributeName] = [UIFont systemFontOfSize:20];
[bar setTitleTextAttributes:titleText];
}