设置导航栏背景和文字属性
1 //设置导航栏背景 2 3 UIImage *image = [UIImage resizeImage:@"navigationbar_background.png"]; 4 5 [[UINavigationBar appearance] setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; 6 7 8 9 NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; //设置导航栏文字属性 10 11 [attrs setObject:[UIColor blackColor] forKey: UITextAttributeTextColor]; //设置文字颜色 12 13 [[UINavigationBar appearance] setTitleTextAttributes: attrs];