<pre name="code" class="objc">if ([self.navigationController.navigationBar respondsToSelector:@selector(setBarTintColor:)]) {
//iOS7之后的使用setBarTintColor方法
[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];
} else {
//iOS6的使用setTintColor但是带有渐变纹理
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
//iOS6的使用setBackgroundImage可以修改导航栏背景色,不带纹理,需要一个背景图
// UIImage *backColorImage = [UIImage imageWithColor:[UIColor blackColor]];
//[self.navigationController.navigationBar setBackgroundImage:backColorImage forBarMetrics:UIBarMetricsDefault];
}