[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];//设置导航栏标题颜色
self.navigationController.navigationBar.backgroundColor = [UIColor blackColor];//导航栏背景颜色
其他设备背景颜色的方法都失效了,包括如下两种方式:
//方式1:
[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]]
//方式2:
[self.navigationController.navigationBar setBackgroundImage:[UIImage createImageColor:[UIColor blackColor] size:CGSizeMake(100, 100)] forBarMetrics:UIBarMetricsDefault];