iOS导航栏的背景颜色设置

时间:2021-10-17 16:58:24

方法一:

(1)

self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
self.navigationController.navigationBar.translucent = YES;
self.navigationController.navigationBar.tintColor = nil;

(2)

self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.translucent = NO;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

(3)

self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.translucent = YES;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

方法二:

//设施导航控制器导航栏的背景图片(遮盖后面的过度黑影(系统自带))
[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationbarBackgroundWhite"] forBarMetrics:UIBarMetricsDefault];