UINavigationBar *bar = [UINavigationBar appearance];
//设置显示的颜色
bar.barTintColor = //设置显示的颜色
bar.barTintColor = [UIColor colorFromHex:@"#fea20f"];
//设置字体颜色
bar.tintColor = [UIColor whiteColor];
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
//或者用这个都行
// [bar setTitleTextAttributes:@{UITextAttributeTextColor : [UIColorwhiteColor]}];
---------------------
导航条透明:
[self.navigationController.navigationBar setBackgroundImage:[UIImagenew] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImagenew]];
-(void)viewWillDisappear:(BOOL)animated{ [superviewWillDisappear:animated]; [self.navigationController.navigationBar setBackgroundImage:nilforBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:nil];}
在 viewWillDisappear 设置下则不影响其他页面的导航条设置
设置导航条是否隐藏
self.navigationController.navigationBar.hidden = YES;
网友评论