iOS 修改导航条样式
程序员文章站
2022-07-13 15:54:18
...
//导航条样式
#import "UINavigationBar+Awesome.h"
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//清空 导航栏背景颜色
[self.navigationController.navigationBar lt_reset];
//清空 返回按钮颜色
self.navigationController.navigationBar.tintColor = nil;
//清空 标题颜色
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor],NSFontAttributeName: [UIFont systemFontOfSize:16]}];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
self.view.backgroundColor = RGBACOLOR(66, 170, 250, 1.0);
//导航栏背景颜色
[self.navigationController.navigationBar lt_setBackgroundColor:[UIColor clearColor]];
// 去掉导航条下边的线
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
//返回按钮颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
//标题颜色
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSFontAttributeName: [UIFont systemFontOfSize:16]}];
}
上一篇: 修改原生导航条样式